Hans,
This is the answer that I got from persistence team members:
Hans Prueller wrote:
> hi together!
>
> I have been using an open source J2EE appserver for the last 4 years and
> currently
> I'm evaluating alternatives as I perhaps want to migrate to another
> product within near future.
>
> One problem I have is, that GlassFish does not allow ORDER BY clauses
> using single-valued
> CMR fields which is a critical requirement in my opinion.
>
> Think of the following:
>
> * @ejb:finder
> * signature= "java.util.Collection findAllSorted()"
> * query ="SELECT DISTINCT OBJECT(c) FROM SubscriberBean AS c ORDER
> BY c.instance.name, c.msisdn"
This query should compile ok. Please send us the error message and the version
you are using. There has been a problem in validating the ORDER BY clause at
some point.
>
> Where "c.instance" is a CMR relation (n:1) to CMP EB InstanceBean. If I
> want to deploy the .ear containing above
> finder, I get an error message that this EJB-QL is violating the
> EJB-SPEC which seems to be the case.
> Then I tried to change the query to make it ejb-ql conform:
>
> * @ejb:finder
> * signature= "java.util.Collection findAll()"
> * query ="SELECT DISTINCT OBJECT(c) FROM SubscriberBean AS c, IN
> (c.instance) as inst ORDER BY inst.name, c.msisdn"
This does not work because the collection member declaration (the IN clause)
requires a collection valued relationship field and c.instance seems to be a
single valued relationship. But using a JOIN clause instead of the IN clause
should work:
SELECT DISTINCT c FROM SubscriberBean AS c JOIN c.instance inst
ORDER BY inst.name, c.msisdn
>
> Which shouldn't be violating the spec, but I get a deployment error that
> "c.instance is not a collection valued CMR field".
>
> The appserver I am currently using works fine with both alternatives. Is
> there really no way to sort a ejb-ql result by a cmr-eb's attribute?
>
> Any help appreciated,
> Hans
>
> PS: I'm not sure how different GlassFish is from SUN AS9 (or if there is
> any technical difference at all) but I did download glassfish
> from sun.com - so I am running SUN AS9.
There is no difference in persistence support.
thanks,
-marina
>