-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: initialize bean with components
PostPosted: Thu Jun 19, 2008 4:47 am 
Newbie

Joined: Mon Aug 23, 2004 7:54 am
Posts: 15
I have a entity bean that has some components (value types). Like User and Address.
I'm trying to reuse the bean from the model in the Presentation Layer, as a backing bean for a JSF form.

Is it ok to put in the default constructor of User the initialization of the address field (Address component)? If I don't do that the JSF form will cush because the address is null.

Code:
class User {
   Address address;
   ...
   public User() {
       address = new Address();
   }
   ...
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 19, 2008 7:46 am 
Beginner
Beginner

Joined: Tue Dec 12, 2006 6:43 am
Posts: 32
Location: London
Hi,
Do a test case in Hibernate where you have the decribed situation. I do not think there will be a problem If you instantiate the Address inside the User default constructor .
When you try to persist the user and the address you explicitly set the address on the user

Regards,

_________________
Alan Mehio
London
UK


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 19, 2008 8:16 am 
Newbie

Joined: Mon Aug 23, 2004 7:54 am
Posts: 15
I guess so much for hbm2java :)
If I use it it will rewrite my constructors...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.