EJB QL
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, October 16, 2002 10:51 PM

Hi All, Can you suggest an equivalent EJB QL for the following sql query "select names from Table_A where id not in (select id from Table_B)" Table_A is having one to many relationship with Table_B(Table_B in many side of relation). id is primary key in Table_A and foreignKey in Table_B(part of compound primary key of Table_B) One way of doing this : Execute equivalent EJB-QL for the sub query(Table_B finder) i.e. "select id from Table_B" first and then get a collection of ids form Table_B and iterate through that collection and pass each id to the finder of Table_A i.e. EJB-QL for below query:    More>>


Hi All,


Can you suggest an equivalent EJB QL for the following sql query


"select names from Table_A where id not in (select id from Table_B)"


Table_A is having one to many relationship with Table_B(Table_B in many side of relation). id is primary key in Table_A and foreignKey in Table_B(part of compound primary key of Table_B)


One way of doing this :


Execute equivalent EJB-QL for the sub query(Table_B finder) i.e.


"select id from Table_B"


first and then get a collection of ids form Table_B and iterate through that collection and pass each id to the finder of Table_A i.e. EJB-QL for below query:


"select names from Table_A where id <> ID RECEIVED FROM Table_B"


The problem here is that if I execute two finders and then iterate through collection and pass id one by one to first query it is going to effect the performance a lot.Please suggest me some solution for above.


I also want to know that if is not possible to get a single EJB-QL for this ,Then is it possible to pass the entire Collection (which we get from Table_B finder) to finder of Table_A instead of iterating and passing each id?


thanks and with best Regards


ravi

   <<Less

Re: EJB QL

Posted By:   Jon_Thorarinsson  
Posted On:   Friday, October 18, 2002 03:37 AM

I have been involved in projects in which we always used JDBC and bypassed entity beans for read only queries. This only gave us happy times, never the blues. More specifically, it performed better, scaled better, was simpler and in some cases smaller code, actually. I'd like to hear more opinions on this, actually.
About | Sitemap | Contact