Hi
I want to pass an collection of primary objects into a finder method (of a CMP bean) so I can then update each bean appropriately.
What I would like to do is something like this
Collection findMyBeans(Collection pkObjects)
with the EJB QL behind this method
SELECT OBJECT(obj) FROM MyBean AS obj where obj.orderId IN (?1)
Is this possible how do I make this work correctly, and if not is there a way around this without multiple queries ie findObject(PKObject pk) for each pk in the collection.
I am using Weblogic 6.1 sp3 and Oracle 8.1.6.
Thanks
Matt
-
EJB Finder methods (1 messages)
- Posted by: matt simmerson
- Posted on: December 09 2002 05:51 EST
Threaded Messages (1)
- Finder collection parameter for "In expression" by Kees van Dieren on April 21 2004 08:50 EDT
-
Finder collection parameter for "In expression"[ Go to top ]
- Posted by: Kees van Dieren
- Posted on: April 21 2004 08:50 EDT
- in response to matt simmerson
I'm also looking for a "In expression" collection parameter example. As mentioned
in the j2ee tutorial, the following thing is possible with EJB QL 2.1:
[code]
SELECT OBJECT(o) FROM country o WHERE o.country IN ('UK', 'US', 'France')
[/code]
What I need is the following:
- finder signature:
[code]
public java.util.Collection findByCountry(Collection aCountryNameList)
[/code]
- query:
[code]
SELECT OBJECT(o) FROM country o WHERE o.country IN (?1)
[/code]
Is this possible, either in EJB 2.1 Or EJB 2.0?
Thanks in advance
EJB 2.1 tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/EJBQL5.html#wp80051 (CTRL-F IN Expressions)