Try to use this:
@Table(name = "COMPANY", uniqueConstraints = { @UniqueConstraint(columnNa
See the full class example below
When trying to save an item with a combination of code/name that already exists, it throws
4797 [main] WARN org.hibernate.util.JDBCExc
4797 [main] ERROR org.hibernate.util.JDBCExc
2009-10-28 17:15:51,774 - [ERROR ] [GENERAL ] Hibernate DB: Error persisting object (class=class com.mobixell.adselector.hi
2009-10-28 17:15:51,774 - Exception in Hibernate DB at:
2009-10-28 17:15:51,774 - org.hibernate.exception.Co
...
Main Topics
Browse All Topics





by: MRomaniPosted on 2009-10-28 at 06:55:33ID: 25683231
basically you would need to have a function that checks to see if there is a matching (code,company) that already exists, and if so, dont add, else its ok to add.