[jboss-user] [EJB 3.0] - Re: ManyToOne gives EntityNotFoundException

alexg79 do-not-reply at jboss.com
Wed Jan 3 07:45:47 EST 2007

I'd say you have a serious problem there. If you use @ManyToOne, the referenced entity must exist. The only other option is to specify that field as a long and retrieve the referenced entity by means of a separate query. Be warned though, getSingleResult() from a Query throws an exception (NoResultException if memory serves) instead of returning null if it can't find the requested entity.

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

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

More information about the jboss-user mailing list