This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Unique constraint error with jpa Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Unique constraint error with jpa" Watch "Unique constraint error with jpa" New topic
Author

Unique constraint error with jpa

Maria Michael
Greenhorn

Joined: Sep 07, 2011
Posts: 18

I am currently stuck with this problem and I hope someone can assist.

My db is in SQL Server. I have certain uniqueness constraints on my tables.
When the entity manager persists it returns correctly the exception

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of UNIQUE KEY constraint 'UN_PERSONTBL_PASSP'. Cannot insert duplicate key in object 'dbo.PERSONTBL'.


Now I need a user friendly error message but I ca;t find a way to automate this other than doing string manipulation.

thanks.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unique constraint error with jpa
 
Similar Threads
Why would a thread fail?
Syntax error for Access Database
OJB and Unique Keys
How to delete a record from a table without a primary key
Not-unique unique column