EJBQL (EJB2.1) and strange results
From: Nikolaj Hansen (nico_at_mailinator.com)
Date: 03/17/05
- Next message: ittay.dror_at_gmail.com: "ant: External entity not found"
- Previous message: Tony Burrows: "Java and the increment operator"
- Next in thread: Nikolaj Hansen: "Re: EJBQL (EJB2.1) and strange results"
- Reply: Nikolaj Hansen: "Re: EJBQL (EJB2.1) and strange results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Mar 2005 12:38:20 +0100
Hi all,
I am writing a CMP layer for a database using XDOCLET. That's ok, the
problem is with a finder, and results I simply cannot understand.
* @ejb.finder
* signature="java.util.Collection findMax()"
* query="SELECT OBJECT(a) FROM ProcessInstancesSchema AS A WHERE
a.id = (SELECT MAX(b.id) FROM ProcessInstancesSchema b)"
This returns two rows. On all beans - not just the one mentioned above.
I tried moving the finder onto another bean with identical results. What
I need to find is the largest key value on a bean (id). On a normal
database it would be:
select max(foo) from bar;
Easy peacy, but not in EJBQL. The finder must return a bean interface,
thats why there's a sub select in the finder method. The nested select
finds the max key, and the outer select reads the entire row for input
to the bean interface. In normal sql:
select * from bar where bar.id = (select max(bar.id) from bar);
However the above EJBQL ALWAYS returns two identical bean instances?
There can only be one...
regards
Nikolaj Hansen
- Next message: ittay.dror_at_gmail.com: "ant: External entity not found"
- Previous message: Tony Burrows: "Java and the increment operator"
- Next in thread: Nikolaj Hansen: "Re: EJBQL (EJB2.1) and strange results"
- Reply: Nikolaj Hansen: "Re: EJBQL (EJB2.1) and strange results"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|