[jboss-user] [JBoss Seam] - Re: Finding an entity using a non- at Id unique identifier
uke
do-not-reply at jboss.com
Wed Aug 22 07:18:31 EDT 2007
Thanks for your response!
I tried overriding the find()-method with the following:
| @Override
| public Employee find() {
| EntityQuery eQuery = (EntityQuery)Component.getInstance("employeeIdByEmploymentNumber");
| Long l = null;
| if(eQuery.getResultCount() > 0)
| l = (Long)eQuery.getSingleResult();
|
| getEntityManager().joinTransaction();
| Employee result = getEntityManager().find( getEntityClass(), (l == null ? getId() : l));
| if (result==null) result = handleNotFound();
| return result;
| }
|
I then aimed the commandButton towards /viewEmployee.xhtml, and added to the -tag for it, but it gives me LazyInitializationException and TransientObjectException.
I wasn't really sure on what to do with the overridden find method, since I'm not really sure why my session is closed, and why it works when I reload the page.
Thanks
uke
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076750#4076750
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076750
More information about the jboss-user
mailing list