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 Markus Suppiger <ma...@yahoo.de> on 2003/09/11 12:40:30 UTC

PB API store and unwanted selects

hi
I have some problems with the PB API (OJB Version: db-ojb-1.0.rc4) and inserts(store) on oracle9i. 
 
1. When i call the broker.store(o, ObjectModificationDefaultImpl.INSERT) method the spy.log looks like this:
INSERT INTO WAP.SLANGUAGE (SLNG_ID,SLNG_LANGUAGE,SLNG_MDCOMMENT) VALUES ('m','testlang','') 
SELECT A0.STBL_ID,.... FROM WAP.ITABLE A0 WHERE A0.SLNG_ID = 'm' 
where does this select come from and how can i prevent it? I have set auto-retrieve="false" for the itable collection and it works fine if i query the db but when i insert a new object then OJB stil tries to auto-retrieve the collection.
Here is my class descriptor
<class-descriptor class="DOsLanguage" table="WAP.SLANGUAGE">
<field-descriptor name="slngId" column="SLNG_ID" jdbc-type="CHAR" conversion="String2CharConversion" primarykey="true"/>
<field-descriptor name="slngLanguage" column="SLNG_LANGUAGE" jdbc-type="VARCHAR"/>
<field-descriptor name="slngMdComment" column="SLNG_MDCOMMENT" jdbc-type="VARCHAR"/>
<collection-descriptor name="colliTable" element-class-ref="DOiTable" auto-retrieve="false" auto-update="false" auto-delete="false">
<inverse-foreignkey field-ref="slngId"/>
</collection-descriptor>
</class-descriptor>
 
2. if the object that i want to insert has a foreignkey (a reference-descriptor in the class-descriptor) and this foreignkey is set then OBJ first queries the db to check if this foreignkey value exists and if the foreignkey value dosnt exist it makes an insert without the fk value.
the spy.log looks somthing like this:
SELECT FK_ID, DESCRIPTION FROM WAP.ATABLE WHERE FK_ID = '2345' 
INSERT INTO WAP.BTABLE (PK_ID,FK_ID) VALUES ('1009','') 
But all i want is an insert (INSERT INTO WAP.BTABLE (PK_ID,FK_ID) VALUES ('1009','2345')) and an Exception from the DB
if there is a FK violation. how can i configure this?
 
Thanks 
Markus



---------------------------------
Gesendet von http://mail.yahoo.de
Schneller als Mail - der neue Yahoo! Messenger.