[jboss-user] [JBoss Seam] - Re: Need help updating multi-table dataTable - injecting lis

dhinojosa do-not-reply at jboss.com
Fri Oct 5 16:48:56 EDT 2007


You update not with the persist method but with the merge method:

So you can do


  | @Name("customerAction")
  | @Scope(<PUT SCOPE HERE>)
  | @Stateful
  | public class CustomerAction {
  | 
  | 
  |     @PersistenceContext(....);
  |     private EntityManager em;
  | 
  |     @DataModel
  |     private List<Customers> customers;
  | 	
  |     @DataModelSelection 
  |     private Customers customer;
  |     
  |     @Factory("customers")	   
  |     public void find()
  |     {
  |     	
  |     	    	customers = em.createQuery("select c"+
  |     								"from Customers c " +
  | 									"where c.userId = :userId")
  | 									.setParameter("userId", user.getUserId())
  | 									.getResultList();
  |     	
  |     }	
  | 
  |     public void update() {
  | 
  |               em.merge(customer)
  |     }
  | }
  | 
  | 
  | 



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

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



More information about the jboss-user mailing list