[jboss-user] [JBoss Seam] - Re: Hibernate Validation / Page Scope --> allways new entity

mrwhite do-not-reply at jboss.com
Tue Jul 25 03:52:28 EDT 2006


Hey you all, 
i solved my problem you were right bfo81. i had to use the conversation scope for my component and its member ( @Out(scope=ScopeType.CONVERSATION)


  | @Stateful
  | @Name("clientPersonAction")
  | @Scope(ScopeType.CONVERSATION)
  | public class ClientPersonEditAction implements ClientPersonEdit{
  | 	
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 	
  | 	@RequestParameter()
  | 	private Long clientPersonId;
  | 	
  | 	@In(required=false) 
  | 	@Out(scope=ScopeType.CONVERSATION,required=false)
  | 	private ClientPerson newClientPerson;
  | 	
  | 	@Begin(join=true) 
  | 	@Factory("newClientPerson")
  | 	public void createNewClientPerson()
  | 	{
  | 		if(clientPersonId != null)
  | 		{
  | 			ClientPersonDAO clientPersonDAO = new ClientPersonDAO(em);
  | 			newClientPerson = clientPersonDAO.getClientPersonById(clientPersonId);
  | 			System.out.println("createNewClientPerson:" + newClientPerson.getId());
  | 		}
  | 		else
  | 		{
  | 			newClientPerson = new ClientPerson();
  | 		}
  | 	}
  | 	
  | 	@End
  | 	public String saveClientPerson() {
  | 		ClientPersonDAO clientPersonDAO = new ClientPersonDAO(em);
  | 		System.out.println("newClientPerson.getId():" + newClientPerson.getId());
  | 		clientPersonDAO.merge(newClientPerson);
  | 		return "home";
  | 	}
  | 	
  | 	@Destroy @Remove 
  | 	public void detroy()
  | 	{
  | 	}
  | 
  | 	@End
  | 	public String removeClientPerson() {
  | 		ClientPersonDAO clientPersonDAO = new ClientPersonDAO(em);
  | 		clientPersonDAO.remove(newClientPerson);
  | 		return "home";
  | 	}
  | 
  | }anonymous wrote : 
  |   | 
  |   | 
  |   | Thats the problem when you come from other webframeworks. Everybody has their own name for scopes and ways to store information in the session.
  |   | 
  |   | Its a little bit confusing that every entity, component and their members can have other scopes.
  |   | 
  |   | thanks
  |   | 
  |   | 

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

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



More information about the jboss-user mailing list