I'm trying something similar as defined in:
http://db.apache.org/ojb/tutorial3.html#Support%20for%20non-decomposed%20m:n
%20mappings

Support for non-decomposed m:n mappings, but using a user-defined collection
instead java.util.Collection as in the example with Persons and Projects.

My test example is:
 - Classes A and B have id and name attributes.
 - Class C is a typed collection of B objects and implements
ManageableCollection.
 - Class A has a collection of B objects. (a C attribute)
   In the collection descriptor of A I declare the
indirection-table="AB_Table".


Reading from database is OK, but when saving an A object I got a
ClassCastException.

Has anyone got success with something similar like this?



This is my test repository_user.xml:

<class-descriptor
  class="A"
  table="A_Table"
>
  <field-descriptor id="1"
    name="id"
    column="id"
    jdbc-type="INTEGER"
    primarykey="true"
    autoincrement="true"
  />
  <field-descriptor id="2"
    name="name"
    column="name"
    jdbc-type="VARCHAR"
  />
  <collection-descriptor
    name="collection"
    collection-class="C"
    element-class-ref="B"
    indirection-table="AB_Table"
    auto-delete="true"
  >
    <fk-pointing-to-this-class column="idA"/>
    <fk-pointing-to-element-class column="idB"/>
  </collection-descriptor>
</class-descriptor>

<class-descriptor
  class="B"
  table="B_Table"
>
  <field-descriptor id="1"
    name="id"
    column="id"
    jdbc-type="INTEGER"
    primarykey="true"
    autoincrement="true"
  />
  <field-descriptor id="2"
    name="name"
    column="name"
    jdbc-type="VARCHAR"
  />
</class-descriptor>


---Publicidad--------------------------------------------------------
�nete a los miles de sin pareja en Meetic... �te vas a enamorar!
http://www.iespana.es/_reloc/email.meetic


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to