Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Dependent Value Classes

 
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,
 
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.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic