[jboss-user] [EJB 3.0] - Changed behaviour of getSingleResult?

heinrich do-not-reply at jboss.com
Tue Mar 13 04:34:44 EDT 2007


Hi,

i have a question concerning the method "getSingleResult()".
The intended behaviour of the method was up to today, that if the underlying query returns more than one result, the mthod returns the first of them.
Only in case of no results, a NoResultFound Exception is thrown.

But, as we found out today, when there are at least two results we get a NonUniqueResultException.
Is this new? Our JBoss is 4.0.5-GA.
And why can't this method just behave as expected?

the workaround would be 

  |  em.createQuery("SELECT Object(o) FROM MyEntity o").setMaxResult(1).getSingleResult();

any ideas?


martin

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

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



More information about the jboss-user mailing list