You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Gunnar Hilling <ne...@hilling.de> on 2003/12/30 12:41:04 UTC
ODMG update
Hello!
I got the following serious problem (RC5):
Using the following code, only one (the last) of the "Zertifikat"-Objects
is updated (it has two foreignkeys pointing to "TextData"). Any clue? This
ist a 1:1-Relation from Zertifikat to TextData. There is currently no
foreign key constraint for the foreign keys in the database because I'm
updating my data structure (Is this a problem?).
I also think, that the calls to "makePersistent" and "tx.flush" shouldn't be necessary at all?
Thanks a lot!
-Gunnar
query.create("select all from " + Zertifikat.class.getName());
DList res =(DList)query.execute();
System.out.println("found "+res.size()+" "+Zertifikat.class.getName());
Iterator iter=res.iterator();
while(iter.hasNext()) {
InterfaceZertifikat zert=(InterfaceZertifikat)iter.next();
tx.lock(zert, Transaction.WRITE);
TextData plain=new TextData(zert.getData(), "Zertifikat "+zert.getKey() + " Beschreibung");
TextData xml=new TextData(zert.getData(), "Zertifikat "+zert.getKey() + " XML");
db.makePersistent(plain);
db.makePersistent(xml);
zert.setPlainData(plain);
zert.setXmlData(xml);
tx.flush();
System.out.println("updated Zertifikat "+zert.getKey());
}
System.out.println("\ndone");
tx.commit();
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
ODMG update (additional info)
Posted by Gunnar Hilling <ne...@hilling.de>.
following a snippet from the generated xml-descriptor:
<reference-descriptor
name="schein"
class-ref="de.infomantis.lotto.business.Zertifikatschein"
auto-retrieve="true"
>
<foreignkey field-ref="scheinId"/>
</reference-descriptor>
<reference-descriptor
name="plainData"
class-ref="de.infomantis.lotto.business.TextData"
auto-retrieve="true"
>
<foreignkey field-ref="textdataPlainId"/>
</reference-descriptor>
<reference-descriptor
name="xmlData"
class-ref="de.infomantis.lotto.business.TextData"
auto-retrieve="true"
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ODMG update
Posted by Gunnar Hilling <ne...@hilling.de>.
Hi!
> Hi Gunnar,
>
> I will try to write a test case for your problem.
> By the way, does your test pass when you switch back to old DList
> implementation class in OJB.properties?
>
I think I found the problems in my code. It was caused by implicit
locking. All worked well when I turned implicit locking off, except I'll
still have to persist the created object explicitly.
(I started another thread about locking and an error which I think should
be detected by the runtime, see above).
Perhaps You could take a look.
I think it is a big problem of OJB (which is great in general) that not
all errors are caught, so it's quite a problem to detect them at all.
Best Regards,
-Gunnar
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: ODMG update
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Gunnar,
I will try to write a test case for your problem.
By the way, does your test pass when you switch back to old DList
implementation class in OJB.properties?
regards,
Armin
Gunnar Hilling wrote:
> Hello!
>
> I got the following serious problem (RC5):
>
> Using the following code, only one (the last) of the "Zertifikat"-Objects
> is updated (it has two foreignkeys pointing to "TextData"). Any clue? This
> ist a 1:1-Relation from Zertifikat to TextData. There is currently no
> foreign key constraint for the foreign keys in the database because I'm
> updating my data structure (Is this a problem?).
>
> I also think, that the calls to "makePersistent" and "tx.flush" shouldn't be necessary at all?
>
> Thanks a lot!
>
> -Gunnar
>
> query.create("select all from " + Zertifikat.class.getName());
> DList res =(DList)query.execute();
> System.out.println("found "+res.size()+" "+Zertifikat.class.getName());
>
> Iterator iter=res.iterator();
> while(iter.hasNext()) {
> InterfaceZertifikat zert=(InterfaceZertifikat)iter.next();
> tx.lock(zert, Transaction.WRITE);
> TextData plain=new TextData(zert.getData(), "Zertifikat "+zert.getKey() + " Beschreibung");
> TextData xml=new TextData(zert.getData(), "Zertifikat "+zert.getKey() + " XML");
> db.makePersistent(plain);
> db.makePersistent(xml);
> zert.setPlainData(plain);
> zert.setXmlData(xml);
> tx.flush();
> System.out.println("updated Zertifikat "+zert.getKey());
> }
> System.out.println("\ndone");
> tx.commit();
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org