File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unique constraint error with jpa

 
Maria Michael
Greenhorn
Posts: 18
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic