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 Yuji Shinozaki <ys...@virginia.edu> on 2003/03/13 14:34:36 UTC

Detecting constraint violations using ODMG

I am in the process of junit-testing an application that is using the ODMG
api.

I am intentionally violating UNIQUE constraints in the junit tests for my
application, and I am now trying to figure out how to handle the resultant
exception:

org.odmg.TransactionAbortedException: Batch entry 0
[Ljava.lang.Object;@89cc5e was aborted.

Is there a way to get the underlying SQL error?

Or is there some other way to detect a constraint violation? (Besides
business logic).

yuji
----
Yuji Shinozaki	                        Computer Systems Senior Engineer
ys2n@virginia.edu			Advanced Technologies Group
(804)924-7171				Information Technology & Communication
http://www.people.virginia.edu/~ys2n    University of Virginia


Re: Detecting Constraint violations/Batch mode

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Yuji,

the ODMG-api use batch mode by default.
I checked in a workaround for this problem
(till problems are fixed).
Get the last version of ConnectionManagerImpl
from CVS (should work with 0.9.9 too)

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/
accesslayer/ConnectionManagerImpl.java

regards,
Armin

----- Original Message -----
From: "Yuji Shinozaki" <ys...@virginia.edu>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Thursday, March 20, 2003 7:29 PM
Subject: Detecting Constraint violations/Batch mode


>
> Using OJB 0.9.9 against Postgres 7.3.1,
>
> When I commit a odmg transaction that results in a constraint
violation.
> (typically foreignkey or unique constraints) I get the following
> exception.
>
> org.odmg.TransactionAbortedException: Batch entry 0
> [Ljava.lang.Object;@89cc5e was aborted.
>
> Which unfortunately, is not very descriptive of the underlying
problem.
> I usually can only diagnose the problem by watching the postgres logs.
>
> Is there a way to get the underlying SQL error?
>
> And a tangential question question:
>
> Why is this referring to a "Batch Entry" even though I have
> batch-mode=false in my repository-database.xml?
>
> yuji
> ----
> Yuji Shinozaki                         Computer Systems Senior
Engineer
> ys2n@virginia.edu Advanced Technologies Group
> (804)924-7171 Information Technology & Communication
> http://www.people.virginia.edu/~ys2n    University of Virginia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>


Re: Detecting Constraint violations/Batch mode

Posted by Oleg Nitz <on...@ukr.net>.
Hi Yuji,

Have you tried using the CVS version of OJB? If not, please try to. 
I think that I've already solved all possible problems with batch mode in 
the CVS version.

Regards,
 Oleg

On Thursday 20 March 2003 18:29, Yuji Shinozaki wrote:
> Using OJB 0.9.9 against Postgres 7.3.1,
>
> When I commit a odmg transaction that results in a constraint violation.
> (typically foreignkey or unique constraints) I get the following
> exception.
>
> org.odmg.TransactionAbortedException: Batch entry 0
> [Ljava.lang.Object;@89cc5e was aborted.
>
> Which unfortunately, is not very descriptive of the underlying problem.
> I usually can only diagnose the problem by watching the postgres logs.
>
> Is there a way to get the underlying SQL error?
>
> And a tangential question question:
>
> Why is this referring to a "Batch Entry" even though I have
> batch-mode=false in my repository-database.xml?
>
> yuji
> ----
> Yuji Shinozaki	                        Computer Systems Senior Engineer
> ys2n@virginia.edu			Advanced Technologies Group
> (804)924-7171				Information Technology & Communication
> http://www.people.virginia.edu/~ys2n    University of Virginia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Detecting Constraint violations/Batch mode

Posted by Yuji Shinozaki <ys...@virginia.edu>.
On Thu, 20 Mar 2003, Armin Waibel wrote:
>
> Hi Yuji,
>
> the ODMG-api use batch mode by default.
> I checked in a workaround for this problem
> (till problems are fixed).
> Get the last version of ConnectionManagerImpl
> from CVS (should work with 0.9.9 too)
>
> http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/
> accesslayer/ConnectionManagerImpl.java
>
> regards,
> Armin


Thanks Armin.


On Thu, 20 Mar 2003, Christopher C Worley wrote:

> Yuji Shinozaki,
>
> You can edit OJB.properties and set the debug level the sql related
> entris equal to DEBUG.  This will log the sql command generated and the
> sql error.  Sorry, i can not answer your second question.
>
> -chris worley
>


Thanks Chris,

I was hoping for API access to the error information to handle this
exceptions programmatically (or at least to pass on a human readable
message).  Maybe I can trace the logging back to it source and see if I
can craft error reporting there by passing a message up through the
Exception chain...

yuji
----
Yuji Shinozaki	                        Computer Systems Senior Engineer
ys2n@virginia.edu			Advanced Technologies Group
(804)924-7171				Information Technology & Communication
http://www.people.virginia.edu/~ys2n    University of Virginia


Re: Detecting Constraint violations/Batch mode

Posted by Christopher C Worley <cw...@ensystex.com>.
Yuji Shinozaki,

You can edit OJB.properties and set the debug level the sql related 
entris equal to DEBUG.  This will log the sql command generated and the 
sql error.  Sorry, i can not answer your second question.

-chris worley

>Using OJB 0.9.9 against Postgres 7.3.1,
>
>When I commit a odmg transaction that results in a constraint violation.
>(typically foreignkey or unique constraints) I get the following
>exception.
>
>org.odmg.TransactionAbortedException: Batch entry 0
>[Ljava.lang.Object;@89cc5e was aborted.
>
>Which unfortunately, is not very descriptive of the underlying problem.
>I usually can only diagnose the problem by watching the postgres logs.
>
>Is there a way to get the underlying SQL error?
>
>And a tangential question question:
>
>Why is this referring to a "Batch Entry" even though I have
>batch-mode=false in my repository-database.xml?
>
>yuji
>----
>Yuji Shinozaki	                        Computer Systems Senior Engineer
>ys2n@virginia.edu			Advanced Technologies Group
>(804)924-7171				Information Technology & Communication
>http://www.people.virginia.edu/~ys2n    University of Virginia
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>  
>



Detecting Constraint violations/Batch mode

Posted by Yuji Shinozaki <ys...@virginia.edu>.
Using OJB 0.9.9 against Postgres 7.3.1,

When I commit a odmg transaction that results in a constraint violation.
(typically foreignkey or unique constraints) I get the following
exception.

org.odmg.TransactionAbortedException: Batch entry 0
[Ljava.lang.Object;@89cc5e was aborted.

Which unfortunately, is not very descriptive of the underlying problem.
I usually can only diagnose the problem by watching the postgres logs.

Is there a way to get the underlying SQL error?

And a tangential question question:

Why is this referring to a "Batch Entry" even though I have
batch-mode=false in my repository-database.xml?

yuji
----
Yuji Shinozaki	                        Computer Systems Senior Engineer
ys2n@virginia.edu			Advanced Technologies Group
(804)924-7171				Information Technology & Communication
http://www.people.virginia.edu/~ys2n    University of Virginia