openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boblitz John <John.Bobl...@BERTSCHI.com>
Subject AW: Constraint violation using OneToOne relationship
Date Thu, 10 Nov 2011 09:10:46 GMT
 

> -----Ursprüngliche Nachricht-----
> Von: M. Walter [mailto:marc.walter@sbb.ch] 
> Gesendet: Donnerstag, 10. November 2011 09:57
> An: users@openjpa.apache.org
> Betreff: Re: Constraint violation using OneToOne relationship
> 
> This is just unbelievable! As I expected using this property 
> has side effects.
> 
> We have boolean fields defined in our database as number(1,0) 
> because Oracle does not know boolean type. Now we get 
> ArgumentExceptions saying that we declare columns that are 
> not compatible with the expected type "bit". These errors 
> never showed up before we added the property 
> "openjpa.jdbc.SchemaFactory".
> 
> Now what?
> 
> Remove the property and use OneToMany instead of OneToOne 
> relationships with programmatically limit the number of child 
> elements to one only? This would be very awful.
> 
> Are there any other options we have got?
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Constraint-violation-using
> -OneToOne-relationship-tp6978223p6980990.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 

I might be wrong here - but it would seem to me that you are trying
to persist the child, not the parent.  

In your definition "A" has a foreign key to "B" which means "B" must
exist prior to "A" and is thus the parent in the relationship.  This is
also what the error message said "parent key not found".

Have you tried persisting "B" instead of "A"?

Just my 2 cents ...

 

John

---- 

Who is General Failure, and why is he reading my hard disk?


Mime
View raw message