Value objects

As i understand value objects can be simple java beans or any collection also.I am using java beans as value objects but some of my beans are really big (having large number of properties)....is that bad design.
[218 byte] By [tikrama] at [2007-9-28 15:27:48]
# 1
it really depends on what your are using value objects for. decide if you need coarse- or fine-grained objects.you can also use nested (composite) value objects, where a value object can have other value objects as its fields.
okozlova at 2007-7-12 12:19:12 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Yeah, I am using composite value objects also for two screens in which i am putting collection objects into a java bean,as regards to my requirement i have to show the data on the screens based on some search criteria....the concern for large value objects bothers me when i have to populate each property using the setProperty methods of the javabean from the resultset...the populate method becomes very large...

Also i wanted to know is putting the ejb home in a session is good or not.

Thanks

tikrama at 2007-7-12 12:19:12 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

Don't worry about the number of set methods.. hei if you have to display a lots of information at on one screen, thats the way to do it... setters are extremely fast

about the EJBs... if you wan't to be able to store reference to a particular EJB object:

* if you are using remote interface - I would recommend storing serialized handle intead of the home object (don't serialize it to String is in one example in J2EE Core Patterns book - use byte[] instead)

* if you are using local beans - store local references in session

IF you all you want to do is cache ejb home objects - take a look at the ServiceLocator pattern (one of the original J2EE Core Patterns, can be found at the patterns section on java.sun.com), and use a HashMap inside of it to store home objects, keyed by JNDI names..

okozlova at 2007-7-12 12:19:12 > top of Java-index,Other Topics,Patterns & OO Design...