Hallo Thomas,

Thanks for your reply!

Here are the complete definitions of BusinessPartner.class and Individual.class

public class BusinessPartner {
        private Integer bpid;
        private String name;
        private String adress;

...No-arg Constructor and the getter and setter Methods

(==> if have change lower case letters)


public class Individual extends BusinessPartner {
        private Integer fk_bpid;
        private String gender;

...No-arg Constructor and the getter and setter Methods

The jdo-Files and the ojb-xml-Files remain the same (expect the lower case letters).

There are no error messages ! The problem is that there is no entry in the 
OJB_BUSINESSPARTNER table but one in the OJB_INDIVIDUAL table.

Log-Files:
New values for BusinessPartners assigned
[JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false
Transaction started
Objects saved
[JDO] DEBUG: OjbStoreManager.flush: demo.myshop.model.ojb.BusinessPartner{201}, P_NEW
[JDO] DEBUG: OjbStoreManager.insert
[JDO] DEBUG: OjbStoreManager.flush: demo.myshop.model.ojb.BusinessPartner{203}, P_NEW
[JDO] DEBUG: OjbStoreManager.insert
[JDO] DEBUG: OjbStoreManager.flush: demo.myshop.model.ojb.BusinessPartner{202}, P_NEW
[JDO] DEBUG: OjbStoreManager.insert
[JDO] DEBUG: OjbStoreManager.flush: end, err=false
[JDO] DEBUG: OjbStoreConnector.commit
Transaction comitted
New values for Individuals assigend
[JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false
Transaction started
Objects saved
[JDO] DEBUG: OjbStoreManager.flush: demo.myshop.model.ojb.Individual{101}, P_NEW
[JDO] DEBUG: OjbStoreManager.insert
[JDO] DEBUG: OjbStoreManager.flush: end, err=false
[JDO] DEBUG: OjbStoreConnector.commit
Transaction comitted

As you can see creating and saving a BusinessPartner works fine!?

Thanks,

Stephan

-----Ursprüngliche Nachricht-----
Von: Thomas Mahler [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 5. Dezember 2003 08:24
An: OJB Users List
Betreff: Re: JDO inheritence


Hi Stephan,

In mapping an inheritance hierachy is not different for OJB/JDO. So if 
you mapping is correct everything should work fine.

I've some questions regarding your classes and mapping:

Stephan Wannenwetsch wrote:
> Hallo,
> 
> I'm trying to store an object which inherits some attributes from a 
> superclass, but values are only be inserted in the subclass table an 
> nothing is inserted in the superclass table.
> 
> Objectmodel:
> Class BusinessPartner()
>  Integer bpid;
>  String attribute

Can't find "attribute" in the jdo file and in the repository? where are the other 
attributes Bpid, Adress and Name?

do you really start your attribute names with upper case letters as 
suggested by the .jdo and the repository.xml?

> 
> Class Individual extends BusinessPartner()
>  String oneMoreAttribute;

cant't find this attribute in the JDO file and the repository?

in this class the attributes seem to start with lower case letters 
(fk_bpid, gender)?

Can you please post the exact layout of BusinessPartner and Individual. Please also 
post the log file and any error messages you get.


thanks,
thomas

> 
> To get it a little bit more complicated I use the JDO plugin my 
> JDO-Files look as follows:
> 
> ==> Individual.jdo
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data
> Objects Metadata 1.0//EN"
> "http://java.sun.com/dtd/jdo_1_0.dtd";>
> <jdo>
>   <package name="demo.myshop.model.ojb">
>     <class name="Individual"
> persistence-capable-superclass="demo.myshop.model.ojb.BusinessPartner">
>       <field name="fk_bpid" persistence-modifier="persistent"></field>
>       <field name="gender" persistence-modifier="persistent"></field>
>     </class>
>   </package>
> </jdo>
> 
> ==> BusinessPartner.jdo
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data
> Objects Metadata 1.0//EN"
> "http://java.sun.com/dtd/jdo_1_0.dtd";>
> <jdo>
>   <package name="demo.myshop.model.ojb">
>     <class name="BusinessPartner" identity-type="datastore">
>               <field name="Bpid" persistence-modifier="persistent"></field>
>               <field name="Adress" persistence-modifier="persistent"></field>
>               <field name="Name" persistence-modifier="persistent"></field>
>     </class>
>   </package>
> </jdo>
> 
> The Repository.xml looks as follows:
> 
>     <class-descriptor
>       class="demo.myshop.model.ojb.BusinessPartner"
>       table="OJB_BUSINESSPARTNER">
>       <field-descriptor
>               name="Bpid"
>               column="BPID"
>               jdbc-type="INTEGER"
>               primarykey="true"
>               autoincrement="true"/>
>       <field-descriptor
>               name="Adress"
>               column="ADRESS"
>               jdbc-type="VARCHAR"/>
>       <field-descriptor
>               name="Name"
>               column="NAME"
>               jdbc-type="VARCHAR"/>
>     </class-descriptor>
>     
>    <class-descriptor
>       class="demo.myshop.model.ojb.Individual"
>       table="OJB_INDIVIDUAL"> 
>    <field-descriptor
>               name="fk_bpid"
>               column="FK_BPID"
>               jdbc-type="INTEGER"
>               primarykey="true"
>               autoincrement="true"/>
>       <field-descriptor
>               name="gender"
>               column="GENDER"
>               jdbc-type="VARCHAR"/>
>       <reference-descriptor name="super"
>            class-ref="demo.myshop.model.ojb.BusinessPartner">
>               <foreignkey field-ref="fk_bpid" />
>         </reference-descriptor>
>     </class-descriptor>
> 
> The source code:
>       //Individual Testdata
>       Individual ind0 = new Individual();
>       ind0.setAdress("Adress IND0");
>       ind0.setName("Name IND0");
>       ind0.setGender("male");
>       t.begin();
>       pm.makePersistent(ind0);
>       t.commit();
> 
> So the problem was that there is only an entry in the OJB_INDIVIDUAL 
> table an none in the OJB_BUSINESSPARTNER table.
> 
> I hope someone can help me !
> 
> Thanks,
> Stephan
> 
> ---------------------------------------------------------------------
> 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]


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

Reply via email to