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 Guido Beutler <gu...@hrs.de> on 2004/03/01 14:51:36 UTC
mysql insert problem
Hello,
I'm using ojb rc5 with mysql 4.0.18 under linux.
OJB runs inside of a jboss-3.2.3.
I have a sample table :
create table a (
id int not null,
ref char(3) not null references b,
primary key (id,ref)
)
create table b (
ref char(3) not null,
primary key (ref)
);
at the corresponding class I have
class a (
int id;
String ref;
b b
);
At the repository I have a reference desriptor from a to b.
<reference-descriptor name="b" class-ref="b" proxy="false"
refresh="false" auto-retrieve="false" auto-update="false"
auto-delete="false">
<foreignkey field-id-ref="2"/>
</reference-descriptor-->
Now my problem. As shown at the reference descriptor I do not
automatically load b.
At a insert on a the reference on b must be set, otherwise mysql reports
a arror that ref can not be null.
If I comment out the reference descriptor at the repository everything
works fine.
If ref is not a String (char) I do not have to set the reference to b.
Where is the difference?
Why ojb uses the reference field to b in case of ref is a String and and
uses the attribuite ref
in case ref is of type int ? Is it because of Sting is a object ant int not?
I would like to run mass inserts and would like to avoid resolving the
references.
best regards,
Guido
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org