• Post Reply Bookmark Topic Watch Topic
  • New Topic

Outer Joins , EJBQL and Dynamic Query

 
Peter Vennel
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am planning to use EJBs in my company. During the initial research, I found I could do everything using EJB, except dynamic queries. But now here the Application Service providers came to the rescue (Weblogic, Webshpere, Borland Enterprise Server) and made provision to run dynamic query, where you can pass query string and get back results .
But now I am in a new hurdle. Currently the dynamic query created by the system uses "Outer Join' . How can I do this with EJBQL.
Is there another approach to this.
Please help.
Thanks.
Peter Vennel.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not know if the app servers support it, but EJB-QL is primarily static SQL with parameters.Isn't it?
 
Bikramjit Singh Bajwa
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB QL is made for only standard query. You can not use joines and all the stuffs. You will have to manupulate the result accordingly after getting collection or object. EJB QL is restrictted.
Thanks,
B S Bajwa
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Vennel:
Weblogic ... made provision to run dynamic query, where you can pass query string and get back results

I haven't tried this yet in my application, but doesn't WebLogic allow you to create dynamic EJB-QL? That was my understanding. Assuming this is what you're doing, can you post the actual query you're creating (the code and/or the end result)?
 
Peter Vennel
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, Weblogic 8.1 allows dynamic queries for EJB. Infact, one of the function also returns Resultset. I have tried and it is great. But you cannot use OUTER JOIN in them.
Example of my outer join query is
select c.COURSE_ID, c,CUORSE_NAME, e.ENROLLMENT_ID, e.STUDENT_ID
from COURSES c, ENROLLMENTS e
where c.COURSE_ID = e.COURSE_ID (+)
order by c.COURSE_ID.
How can I implement this in EJB-QL or dynamic query without using standard OUTER JOIN syntax.
I found one way to do this is by using UNION of two separate queries. But UNION is also not supported by dynamic queries in Weblogic.
Last option is to run them as two separate queries and get the data , one after another . (don't want to do this).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!