[jboss-user] [JBoss Seam] - Re: Multiple <s:convertEntity /> from different persistence

jarkko@jab.fi do-not-reply at jboss.com
Tue Oct 30 13:29:57 EDT 2007


And actually I solved the issue by using the unrestricted entity manager for getting the list and the use the restricted entity manger to load the entity.


  | public List <Manager> getManagers() {
  |                String query = "from Manager";
  |                // use the unrestricted entity mananger to get the list
  | 		Query q = adminEntityManager.createQuery(query);
  | 		return = q.getResultList();
  | }
  | 

And later, when the admin is updating the entity

  | public Manager modify(Manager selectedManager) {
  | 	
  |         return  unrestrictedEntityManager.find(Manager.class, selectedManager.getId());
  | }
  | 

EntityManager.find() does load the entity, even if manager.deleted is not null (and deleted is less than todate). So the filter is not applied when using EntityManager.find(), but I'll need to check that this is always true.

And this works because s:convertEntity also uses the same unrestrictedEntityManager.




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

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



More information about the jboss-user mailing list