violation « Key « JPA Q&A

1. Hibernate + Primary Key Violation

Hello all! Im getting the following error: org.hibernate.exception.GenericJDBCException: could not insert: [Table4VO] And this is the reason: SEVERE: [Atinav][JDBC SQL Server Driver:Ver C3.0C] Violation of PRIMARY KEY constraint 'PK'. Cannot insert duplicate key in object 'Table4'. // --------------------- MY CENARIO IS: #1. My rellational mapping its like: Table1VO (Major table whith many to one relationship for Table2VO where cascade="save-update") Table2VO (Table ...

2. many-to-many with link table foreign key violation

I have a many to many with a link table and every time i delete one of the objects i get a foreign key violation on the link table. I am using hibernate 3, but an older version of it Using the author/book example here is what my mappings look like: For author:

3. Detecting Unique Key Violation

Can someone give me clues on how to best implement this requirement please? I am implementing a [b]User[/b] class that has a [b]userName[/b] property that must be unique. So, if a user specifies a username that is not unique, I must detect and report this back to the user. In the the mapping file for User and in the database table ...