db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bart Molenkamp" <b.molenk...@bizzdesign.nl>
Subject RE: Problems with extending classes
Date Tue, 27 Jul 2004 10:36:04 GMT
I made the change, but it still doesn't work :( I'm back at where I was,
getting the following error:

org.apache.ojb.broker.KeyConstraintViolatedException: SQL failure while
insert object data for class
com.bizzdesign.persistence.impl.ojb.metamodel.DataTypeImpl, PK of the
given object is [ name=null], object was
com.bizzdesign.persistence.impl.ojb.metamodel.DataTypeImpl@5d174f,
exception message is [Try to insert null into a non-nullable column in
statement [INSERT INTO MetaDataTypes (name) VALUES (NULL) ]]

Somehow, OJB creates a new instance of the class DataTypeImpl, the new
instance has a PK that is null. But IMO it should use the object that I
have passed, that object has the PK set (both PrimitiveTypeImpl.name and
DataTypeImpl.name are set). Why does it create a new instance?

And are you able to get the sample working described in the "advanced
technique" document? Or is anybody else?

Bart.

-----Original Message-----
From: Thomas Dudziak [mailto:tomdz@first.fhg.de] 
Sent: Tuesday, July 27, 2004 11:25 AM
To: OJB Developers List
Subject: Re: Problems with extending classes

Bart Molenkamp wrote:

>Hi,
>
>Thanks for your reply. I solved a part of the problem. It had indeed to
>do with the primary key. But now I have another problem: when I store
an
>instance of PrimitiveTypeImpl it should do (if I understand it
>correctly) two inserts in the database:
>insert into METADATATYPES values ('integer');
>insert into METAPRIMITIVETYPES values ('integer', 'java.lang.Integer');
>
>But only the insert in METADATATYPES is executed, and the insert into
>METAPRIMITIVETYPES is not. What am I doing wrong now?
>  
>
I was wondering why the base class has a non-anonymous pk whereas the 
subclass has the same pk but this time anonymous ? I guess, there is a 
basetype-subtype relationship between the two, which means that the 
subtype has in effect a field name (though it might not be able to 
access it if its private in the basetype). Try with the pk of 
MetaPrimitiveTypes having non-anonymous access.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message