hallo armin,
it is the same behavor!
field "autoid" in table "kunde"
is also "null" ...

mmm (1.0rc5 - downloaded yesterday morning)
libs in classpath:
commons-collecton
commons-dbcp
commons-lang
commons-pool
db-ojb10rc5

(and mysql...) :-)

i did:

Auto auto = new Auto();
auto.setFarbe("blau");

Kunde kunde = new Kunde();
kunde.setNachname("Bode");
kunde.setVorname("Ralle");
kunde.setAuto(auto);
        
//OJB aktivieren!
broker.beginTransaction();
broker.store(kunde);
broker.commitTransaction();



--- Ralf Bode <[EMAIL PROTECTED]> schrieb: > Hi
Armin, Brain and the rest :-)
> 
> hier is my code (a simple test-example)
> CAR:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //the CAR
> public class Auto implements Serializable{
> 
>       private String farbe;
>       public Auto() {
>       }
> 
>       public String getFarbe() {
>               return farbe;
>       }
> 
>       public void setFarbe(String string) {
>               farbe = string;
>       }
> 
> }
> 
> CUSTOMER:
> package de.ralle;
> 
> import java.io.Serializable;
> 
> //my customer!
> public class Kunde implements Serializable{
>       
> 
>       private String vorname;
>       private String nachname;
> 
>       private Auto auto;
> 
> 
>       public Kunde(){ 
>       }
> 
>       public Auto getAuto() {
>               return auto;
>       }
> 
>       public String getNachname() {
>               return nachname;
>       }
> 
>       public String getVorname() {
>               return vorname;
>       }
> 
>       public void setAuto(Auto auto) {
>               this.auto = auto;
>       }
> 
>       public void setNachname(String string) {
>               nachname = string;
>       }
> 
>       public void setVorname(String string) {
>               vorname = string;
>       }
> 
> }
> 
> and XML:
> <class-descriptor 
>       class="de.ralle.Kunde" 
>       table="Kunde" >
> 
>       <field-descriptor
>               id="1"
>               name="id"
>               column="id"
>               jdbc-type="INTEGER"
>               primarykey="true"
>               access="anonymous"/>
>       <field-descriptor
>               id="2"
>               name="vorname"
>               column="vorname"
>               jdbc-type="VARCHAR"/>
>       <field-descriptor
>               id="3"
>               name="nachname"
>               column="nachname"
>               jdbc-type="VARCHAR"/>
>       <field-descriptor
>               id="4" 
>               name="autoId" 
>               column="autoid" 
>               jdbc-type="INTEGER"
>               access="anonymous"/>
> 
>       <reference-descriptor 
>               name="auto" 
>               class-ref="de.ralle.Auto"
>               auto-retrieve="true"
>               auto-update="true"
>               auto-delete="true">
>               <foreignkey field-ref="autoId"/>
>       </reference-descriptor>
> </class-descriptor>
> <class-descriptor 
>       class="de.ralle.Auto" 
>       table="auto">
>       <field-descriptor 
>               id="1" 
>               name="id" 
>               column="id" 
>               jdbc-type="INTEGER" 
>               primarykey="true"
>               access="anonymous"/>
>       <field-descriptor 
>               id="2" 
>               name="farbe" 
>               column="farbe" 
>               jdbc-type="VARCHAR" />
> </class-descriptor>
> 
> 
> 
> THANKS!
> 
>  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: > Hi
> Ralf,
> > 
> > it does deal with anonymous fields, but only in
> > conjunction with 1:1 
> > references. Please post class-descriptor and
> source
> > for Customer, Car.
> > 
> > regards,
> > Armin
> > 
> > Ralf Bode wrote:
> > 
> > > Hi Armin.
> > > 
> > > okay i didn�t know about 1.0rc5 isn�t
> > > dealing with anonymous-keys.
> > > 
> > > so i do like suggested in 1:1-mapping.
> > > 
> > > but then in my Beans i have
> > > int carId
> > > Car car;
> > > 
> > > i do now:
> > > setCar(Car c){
> > > car = c;
> > > carId = c.getId();
> > > }
> > > 
> > > but i think this is redundant, isn�t ?
> > > now i am very confused on dealing with OJB...
> > > 
> > > a short, and last question,
> > > why doesn�t OJB1.0.rc5 not deal with
> > anonymous-keys
> > > i thought its a nice feature!
> > > 
> > > greetings ralf
> > > 
> > > 
> > >  --- Armin Waibel <[EMAIL PROTECTED]> schrieb: >
> > Hi,
> > > 
> > >>Ralf Bode wrote:
> > >>
> > >>>Hi Armin,
> > >>>thanks for your patience, first!
> > >>>but the things with declaring PK_Fields
> > >>>i read at:
> > >>>
> > >>
> > >
> >
>
http://db.apache.org/ojb/howto-use-anonymous-keys.html
> > > 
> > >>>i did everything like told me :-)
> > >>>the document is written nice and understandful,
> > >>
> > >>doh! Assume the current implementation doesn't
> > >>achieve this. All 
> > >>anonymous keys are held in an internal map using
> > the
> > >>object itself as 
> > >>key. Reading will be successful, but when the
> > object
> > >>e.g. will be 
> > >>serialized and then returned to OJB the
> anonymous
> > PK
> > >>field will never be 
> > >>found (object does not match a key), its only
> 
=== message truncated === 

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de

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

Reply via email to