• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dependent Value Classes

 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vish.
I'm not completely out of the fog, but that helped.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic