Hello Guys!
when i do the following named query on GlassFishv1 it returns only one line, thus i can fetch it withe getSingleResult() operation.
However i just upgradeed to the Sun distribution of Glassfish V2 and the same operation gives me a javax.persistence.NonUniqueResultException:
any idea why this might be?...
the application is now in production and re-coding the queries is not a viable option as there are several getSingleResult queries that would need to be changed and the regresion test for that compared to keep living with glassfishV1 is not too good of a choice.
my named query on the entyty class:
@NamedQuery(name = "Usuarios.findBySNombreUsuario", query = "SELECT u FROM Usuarios u JOIN u.iDperfilCollection t JOIN u.iDclientesCollection c WHERE u.sNombreUsuario = :sNombreUsuario"),
the way i use it is the following:
public Usuarios findByName (String name)
{
Query query =
em.createNamedQuery("Usuarios.findBySNombreUsuario");
query.setParameter("sNombreUsuario",name);
Usuarios items = (Usuarios) query.getSingleResult();
return items;
}
[Message sent by forum member 'tololo' (tololo)]
http://forums.java.net/jive/thread.jspa?messageID=240551