-->
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: private member variables vs. Map in POJO
PostPosted: Thu Nov 26, 2009 8:09 pm 
Newbie

Joined: Thu Nov 26, 2009 8:01 pm
Posts: 1
I'm new to Hibernate, and need some advice on two different POJO implementation approaches for each hbm definition.
For every property that I define inside Hibernate hbm file, the first approach is to declare private member variables, and corresponding getters and setters functions. The second approach is to create a Map variable that will hold all values (using property name as the key) as Object, and still have the getters and setters with the proper type cast.

Either approach can work. I need some advice as to the pros and cons. I know that the using Map to store values will require field type such as int to do a conversion to object before storing into Map. This is slower and uses more memory. Are there any other arguments?

Thanks.


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.