That means that a AddressValue will be created containing all fields of the entity bean "eager" means the VO is build on ejbLoad
Customer Bean have
* @ejb:value-object name="CustomerLight" match="light"
* @ejb:value-object name="CustomerNormal" match="normal" instantiation="eager"
* @ejb:value-object name="Customer" match="*"
3 VO will be build. CustomerValue containing all fields CustomerNormalValue contains only fields that have a corresponding
@ejb:value-object match="normal"
For example getCredit()
Etc... For LightValue
You can avoid a field appearing in the VO (for example I XMLized/String Object that are saved in the DB and SAX them on read. Then my String has no meaning in my VO. I want the object.
Use @ejb:value-object match="*" exclude="true"
(Account.getLastModifiedDate) to avoid a field to be picked up in the VO
In the opposite use @ejb:value-object name="..." match="..." on non persistent fields to put it in the VO
See Accountean.getTotalAmount
The attribute relation="external" on a field say this: because the VO is cached in the bean, sometimes you wan to update some fields because you did not have an setSth() that killed your VO. For example TotalAmount looks at other Account. The Acount on wich you get the VO, you must rerun this computation at get time.
Aggregation (1-1)
AccountBean ---> CustomerBean
@ejb:value-object match="*" aggregate="CustomerNormalValue" aggregate-name="OwnerNormalValue"
Association (1-1)
CustomerBean ---> AddressBean
...
For these look at generated code. The idea is "responsability" of an entity bean over its related relationship
For Composition Customer knows he is the master of Address, .... In all these, aggregate/compose is the Java type of the aggregate/compose VO (you could read test.interfaces... In fact) Aggregate-name/compose-name is the name given to the get/set method
Aggregation (1-n)
CustomerBean ---> AccountBean
@ejb:value-object match="*" aggregate="CustomerNormalValue" aggregate-name="OwnerNormalValue"
...
Association (1-n)
CustomerBean ---> AddressBean
@ejb:value-object
* match="normal"
* type="Collection"
* relation="external"
* compose="test.interfaces.AddressValue"
* compose-name="ShippingAddressValue"
* members="test.interfaces.Address"
* members-name="ShippingAddress"
For 1-n I also need the type of what is in the Collection so the members and members-name
For 1-n relation="external" should always be used.
Finally this has not been tested and was written with CMP 1.1 in mind, so more work will be needed for sure.
This covers more than Data Object but I am listening to any improvements that could be added...