[jboss-user] [JBoss Seam] - Re: How to get a child/reference entity to load when the par

dustismo do-not-reply at jboss.com
Fri Dec 14 18:14:24 EST 2007


Ah, I guess I didn't read your code close enough.  


If you want to do something like:

  | if (existing.size()==0)
  |       {
  | user.setAccount(new Acount(/*initialization params*/));
  |          em.persist(user);
  |          log.info("Registered new user #{user.username}");                       
  |          return "/registered.xhtml";                                             
  |       }
  | 

you need to add cascading to your user model.. i.e.

  | @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY )
  |     @JoinColumn( name = "account_id" )
  |     public Account getAccount()
  |     {
  |         return this.account;
  |     }
  | 
  | 


Hope that helps,
Dustin

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

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



More information about the jboss-user mailing list