Forums Register Login

Dependent Value Classes

+Pie Number of slices to send: Send
Hi All:
The spec says -

10.6.3 Dependent value classes
The following are the requirements for a dependent value class:
The class must be defined as public and must not be abstract.
The class must be serializable.


What is a dependent value class and what is it used for? Please provide and example of its use if possible.
Thanks,
+Pie Number of slices to send: Send
Dependent classes are Value Objects.
They are mostly read-only, implement Serializable and have public members.
Since EJB data can be wrapped in one single Object(Dependent class), they tend to reduce the number of remote calls.
I could think of this example:
In a BMP Entity bean scenario...Order and Orderline Items.
Order can be an Entity bean but Orderline Item need not necessarily be an Entity bean. Orderline Items could be a collection (Vector/ArrayList) of Orderline Items defined as a member inside the Order Entity bean.
Each Orderline Item is defined as a simple Java class implementing Serializable. The Collection of Orderline Items is populated/updated in ejbLoad()/ejbStore()...A public method could be exposed in the remote method to access the Orderline items.
In this scenario, Orderline Items are called Dependent classes.This kind of a strategy improves the performance of a BMP entity bean.
You can implement the above scenario using a CMP2.0 Entity beans also without using any dependent classes, but that is a design decision...
Hope that helps!
+Pie Number of slices to send: Send
Thanks Vish.
I'm not completely out of the fog, but that helped.
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 601 times.
Similar Threads
More Questions on Entity Bean
Dependent value classes
Question about Mikalai Zaikin Chapter 6
Question on Class Diagram (Part 2)
inner classes
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:12:23.