[jboss-user] [EJB 3.0] - Re: JbossQL and m.createQuery(.. OFFSET 5 LIMIT 23)

laszlo.fogas do-not-reply at jboss.com
Sun Sep 3 06:04:09 EDT 2006


ok

I was wrong:

It generates the desired offset/limit queries unless you use join fetch in your query to initialize lazy collections.

In the docs: (http://docs.jboss.org/ejb3/app-server/HibernateEntityManager/reference/en/html_single/index.html#d0e751)
"Nor should fetch be used together with setMaxResults() or setFirstResult(). It is possible to create a cartesian product by join fetching more than one collection in a query (as in the example above), be careful the result of this product isn't bigger than you expect. Join fetching multiple collection roles also sometimes gives unexpected results for bag mappings, so be careful about how you formulate your queries in this case.

TODO: The last statement is useless and typical developer thinking, please elaborate. The word "sometimes" should never appear in any technical documentation."

funny :)  So what is the status of this problem(?) now? 

I know the collection.size() workaround, but i don't like it!! I think that solution is much slower. Is there other solution?

lazlo






View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969089#3969089

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969089



More information about the jboss-user mailing list