Em Qua, 2002-03-06 �s 04:29, Vincent Harcq escreveu:
> What is <dependent-value-class> ?
> Object loaded in same jdbc as the ejbLoad of the entity bean ???
> Something like dependant VO of ejb spec pfd1/2 ???

The EJB 2.0 spec says the following about dependent value classes:

>---<
10.3.3 Dependent Value Classes
A dependent value class is a concrete class. A dependent value class may
be a legacy class that the bean provider wishes to use internally within
an entity bean with container-managed persistence, and/or it may be a
class that the bean provider chooses to expose through the remote (or
local) interface of the entity bean.

(...)

A dependent value class must be serializable. The internal structure of
a dependent value class is not described in the EJB deployment
descriptor.
>---<

In other words, a DVC is any concrete, serializable class that is an
attribute of a CMP entity bean. It is not described in any way in the
standard deployment descriptors. It's up to the vendors to define what
to do with DVC's.

In JBoss you can define a DVC to be stored in multiple columns of a
table. For example: I have a Customer bean, which has an address field,
which is of the type Address.

Address is a simple concrete, serializable class that implements getters
and setters for a couple of properties like street, city, state... If
Adress is not described in the JBoss deployment descriptor, the CMP
engine will store it as a blob. However, you can describe the DVC to be
stored on multiple columns over the entity table.

It would look something like this:

<entity>
  <ejb-name>Customer</ejb-name>
  <table-name>customer</table-name>

  (...)

  <!-- the "address" field on Customer bean is a example.Address -->
  <cmp-field>
    <field-name>address</field-name>
    <property>
      <property-name>street</property-name>
      <!-- customer column where to store the address.street attribute -->
      <column-name>cust_address_street</column-name>
    </property>
    <property>
      <property-name>city</property-name>
      <column-name>cust_address_city</column-name>
    </property>
    <property>
      <property-name>state</property-name>
      <column-name>cust_address_state</column-name>
    </property>
  </cmp-field>

  (...)

</entity>

(...)
   

<dependent-value-class>
  <description>An Address class</description>
  <class>example.Address</class>
    <property>
      <property-name>street</property-name>
      <!-- a "default" column name to use if not specified on the cmp-field -->
      <column-name>address_street</column-name>
    </property>
    <property>
      <property-name>city</property-name>
      <column-name>address_city</column-name>
    </property>
    <property>
      <property-name>state</property-name>
      <column-name>address_state</column-name>
    </property>
</dependent-value-class>

I hope that explains what are DVC's and how JBoss uses them, Vincent.
They're great for big, complex entities (In my app every customer has 3
addresses, each address made up of 8 different fields. The customer
table has over 40 columns -- it would be a mess to map this cleanly
without DVC's).

I'll be sending the files to you in a private message. I've even made a
few more modifications concerning using ValueObjects inside struts'
ActionForms.

The application I'm developing is my motivation behind all these
modifications. With them I'm able to correctly generate and use the
EJB's and value objects in my application. I don't know if i can call
them "deployed EJB's", since the app is still being developed. However,
things are going fine here :)

-- 
Pazu <[EMAIL PROTECTED]>

Anime Gaiden - De f�s para f�s, sempre.
http://www.animegaiden.com.br

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to