db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.fhg.de>
Subject Re: Problems with extending classes
Date Mon, 26 Jul 2004 15:39:57 GMT
Bart Molenkamp wrote:

>I've a problem with extending classes. The "advanced technique" document
>describes three ways for mapping class hierarchies. I want to use the
>"Mapping Classes on Multiple Joined Tables" variant. My structure is
>pretty much the same as the one described in the "advanced technique"
>document, but it doesn't work. The exception I get is:
>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
>exception message is [Try to insert null into a non-nullable column in
>statement [INSERT INTO MetaDataTypes (name) VALUES (NULL) ]]
Your repository.xml seems ok, except that the base-type pk field (name) 
is different from the sub-type pk field (dataTypeName) . Don't know 
whether that's good because in effect the PrimitiveTypeImpl class has 
probably two pk's now ...
The error states that you tried to insert an object into the database 
that had no or only an incomplete pk value (NULL is not allowed for 
pk's). As you declared no auto-setting of the pk (e.g. via a sequence), 
you have to supply the value of the base-pk prior to inserting, e.g. set 
the name field of your PrimitiveTypeImpl instance to some value.


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

View raw message