Thanks for help .... @ Thomas Dudziak

I have a Object called "Produktgruppe". In each of this there is a Collection of Produktgruppe.
For this i have a table called "Produktgruppe" with rows: Id, Inid, name
In "inid" i will store the reference to the group over it (selfjoin between inid and id) and null if it is one of the master groups. So for example i could have main groups with cars and computer und it car e.g. ford and opel,...


The saving of data works fine ... here an example of a table:
+-----+----------+------+
| id  | name     | inid |
+-----+----------+------+
|  21 | testkat  | NULL |
|  41 | neuKat   | NULL |
|  81 | asdasdf  | NULL |
| 181 | blubber  | NULL |
| 201 | blubber2 |   41 |
| 221 | test3    |   41 |
+-----+----------+------+

here i have 4 main groups an in group "neuKat" 2 groups called blubber2 and test3.

I have set auto-retrieve= true! So i think if i load the neuKat Object, i also retrieve the 2 groups blubber2 and test3 in the collection of neuKat. But i did not work???

Thanks, Thomas

Here my Deskriptor of Produktgruppe:
<class-descriptor
   class="de.ba.studi.chtp.model.Produktgruppe"
   table="Produktgruppe"
   auto-retrieve="true"
>
   <field-descriptor
       name="id"
       column="id"
       jdbc-type="INTEGER"
       primarykey="true"
       autoincrement="true"
   >
   </field-descriptor>
   <field-descriptor
       name="inId"
       column="inId"
       jdbc-type="INTEGER"
   >
   </field-descriptor>
   <field-descriptor
       name="name"
       column="name"
       jdbc-type="VARCHAR"
       primarykey="true"
   >
   </field-descriptor>
   <collection-descriptor
      name="produktgruppen"
      element-class-ref="de.ba.studi.chtp.model.Produktgruppe"
      orderby="inId"
      sort="DESC"
      auto-retrieve="true"
      auto-update="true"
   >
      <inverse-foreignkey field-ref="inId"/>
   </collection-descriptor>
</class-descriptor>

Thomas Dudziak schrieb:

Thomas Papke wrote:

Hello to OJB-Users,

I started to learn how to use OJB with a little example, but here i have a problem. Maybe anyone could help.

I have 3 classes with a few attributes:
abstract class benutzer;
   - string name
   - string vname
   - int benutzer_id
   - string passwort
   - string benutzername
   - string ojbConcreteClass
class stduser extends benutzer;
   - no extra attributes yet
class admin extends benutzer;
   - bollean benutzer;

I want to map the conrete objects stduser and admin to the 3 tables: benutzer, stduser and admin. In table benutzer, i want to have the attributes of benutzer and in stduser/admin the special attributes.

Everything works fine if benutzer is not abstract. If it is set to abstract i got the following error if i want to store a stduser:

Can't create new base class object for 'de.ba.studi.chtp.model.Benutzer'

Maybe anybody could help. I can't find a docu how to map classes extended from a abstract class.


I wonder, both of your super-references have no foreignkey, which should not work (OJB should give you an error about this, if not then there is a bug in the reading of the repository.xml). Try adding a foreignkey pointing to benutzer_id.
If that still doesn't work, then please post some more details (used OJB version, exact stacktrace etc.).


Tom

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



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



Reply via email to