On 10 June 2014 16:31, Kevin Sutter <kwsut...@gmail.com> wrote: > I think you are just describing a unique constraint for a column (other > than the primary key).
Sadly not, it isn't simply a question of putting a unique constraint on some columns. As I pointed out, in some cases a duplicate is allowed, in others it is not. I could just re-arrange the database design, but I don't own the design it is something that has been given to me. Consider the case where the criteria to allow an insert to happen is some arbitrary query, not just a unique constraint. This can be accomplished with a WHERE NOT EXISTS (SELECT ... the arbitrary insertion condition). How can this be done with JPA/OpenJPA? Rupert