db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Kröz (JIRA) <j...@apache.org>
Subject [jira] Commented: (OJB-52) KeyConstraintViolatedException during store
Date Fri, 01 Jul 2005 17:42:57 GMT
    [ http://issues.apache.org/jira/browse/OJB-52?page=comments#action_12314905 ] 

Michael Kröz commented on OJB-52:
---------------------------------

Well, ahm, before everyones rotflol or something similar, shame on my head,
my little testprogramm was terribly wrong (in two ways, actually).
I forgot to set auto-update to "true" for the saved object reference (and something
else too, I better keep in silence...),which means cascading for object references
was not enabled. Anyway, my fault.

But I will complain at least in one way and thats, that the sql constraint violation error
sql error code 23000 I got, is really somewhat misleading for the mistake I actually found
and for someone who wants to avoid sql with an OR mapper, I dont expect SQL errors
for such basic things. Of course this error is logical, if I think about it, as it can mean
there exists a reference to nowhere.

Probably someone should start a collection with popular ojb errors what they mean, when
they occur and how they can be fixed. This might save a lot of people a lot of time including

the support team.

Regards,
Michael.

And now, someone can close this not-existing BUG. 


> KeyConstraintViolatedException during store
> -------------------------------------------
>
>          Key: OJB-52
>          URL: http://issues.apache.org/jira/browse/OJB-52
>      Project: OJB
>         Type: Bug
>     Versions: 1.0.3
>  Environment: ojb 1.0.3, hsqldb from ojb-blank, enriched with junit, ojb-junit
> java 1.4.2_04
>     Reporter: Michael Kröz
>     Priority: Minor
>  Attachments: TestArguments.java, TestArguments.java
>
> Hi,
> I am getting a KeyConstraintViolatedException during store of an object structure.
> I supplied a test that shows this. Can someone verify that this is really a bug?
> The actual exception message was this:
> testThree(TestArguments)org.apache.ojb.broker.KeyConstraintViolatedException: SQL failure
while insert object data for class Someclass, PK of the given object is [ Id=1], object was
**Someclass ** Id: 1 text:some attribute, exception message is [Integrity constraint violation:
SOMECLASS_FK_1 table: OTHERCLASS in statement [INSERT INTO Someclass (Id,otherclassID,text)
VALUES (1,2,'some attribute') ]], SQL code [23000]
> 	at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImpl.java:266)
> 	at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java:1754)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
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