db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bergquist, Brett" <BBergqu...@canoga.com>
Subject RE: Force unique constraint to be enforced at statement execution?
Date Tue, 08 Jan 2013 18:51:45 GMT
Not exactly familiar with Spring Data JPA but I am with JPA with container managed transactions.
  Assuming you have a handle on the EntityManager, invoke the 'flush' method on it which will
cause the entity manager to perform the database operations before the commit.   You can then
wrap your code with a try/catch block if needed to catch the exception that occurs.

-----Original Message-----
From: Matthew Adams [mailto:matthew@matthewadams.me] 
Sent: Tuesday, January 08, 2013 1:46 PM
To: derby-user@db.apache.org
Subject: Force unique constraint to be enforced at statement execution?

Hi all,

How do I force a unique constraint to be enforced upon statement execution instead of at transaction

I'm using Spring Data JPA over DataNucleus & Derby (embedded), and Spring's persistence
exception translation proxy is not translating the unique constraint exception because it's
happening at transaction commit instead of when the statement is executed.


View this message in context: http://apache-database.10148.n7.nabble.com/Force-unique-constraint-to-be-enforced-at-statement-execution-tp126304.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

View raw message