-->
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.  [ 1 post ] 
Author Message
 Post subject: Initialization of Sets
PostPosted: Wed Jul 11, 2007 7:17 pm 
Beginner
Beginner

Joined: Mon Jun 25, 2007 11:57 pm
Posts: 28
Hi,

Does anybody know what is the "best practice" way of initializing elements in a Set.

Scenario is that class contains a set which is to be used to display (just the first record) to the screen. However it is possible that this set may be empty and therefore when i go to access the first element using : setelements[0] the page does not display correctly.

Workaround i have used is that when parent object is initialised, i check to see if the set contains an element. If it doesn't i create one and insert it into the set.

Is there a more elegant way of doing this? Such as an attribute of the <set> element that tells us to create an object by default? Or has anyone got any better suggestions?

Thanks a lot.
John


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

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.