It seems that the ejb value objects are somewhat incomplete. 

Therefore, I have taken it upon myself to do some work on them. There are a few 
flaws that I see in the value objects now. 

1) No synchronization. It is likely that under some situations it would be nice 
to be able to turn on synchronization. 
2) Returning bare collections. We should return unmodifiable collections to 
force less error prone code. 
3) Synchronized collections should be an option, once again, to reduce the 
dangers of multi threaded code. 
4) Should implement Cloneable. 
5) Implement Comparable?
6) Should not use arrays to pass around relationship data, the construction and 
deconstruction of arrays is inefficient, especially for large numbers of 
arrays. 
7) Should not allow outside access to setAdded*s(), and other bookkeeping 
collections. 

As a result, I made the following changes. 

1) implemented Comparable. 
2) Added an "ordering" class level option.
        a) ordering = "strict", ordering/equality/hashCode is only dependant on 
the primary key of the object. Object implements Comparable if and only if all 
primary key fields are Comparable. 
        b) ordering = "permissive". equality/hashCode based on all fields, but 
not relationships. 
        c) default is "permissive"
3) Added "synchronization" class level option.
        a) synchronizaton = "none": same as before. 
        a) synchronization = "partial": all [Collection|Set]s become 
Collections.synchronized[Collection|Set]();
        a) synchronization = "full": Same as "partial", but all methods 
synchronized as well.
4) All returned [Collection|Set]s are 
Collections.unmodifiable[Collection|Set](...).
5) Added get*Collection() method that returns unmodifiable [Collection|Set] of 
the relations.

In the future, we may wish to remove a few of the more dangerous methods. 

Also, the EJB (CMP) template should automatically create properly named 
get*Value() and set*Value(*Value input) methods without requiring the addition 
of them into the Bean class, if it is abstract. Have an option to make the 
ejbCreate(*Value input) and ejbPostCreate(*Value input) method as well, if bean 
class is abstract. 

What do you all think? Any suggestions?

-Tyler






This e-mail message is intended only for the named recipient(s) above. It may 
contain confidential information. If you are not the intended recipient you are 
hereby notified that any dissemination, distribution or copying of this e-mail 
and any attachment(s) is strictly prohibited. If you have received this e-mail 
in error, please immediately notify the sender by replying to this e-mail and 
delete the message and any attachment(s) from your system. Thank you.

Reply via email to