It seems there is a problem with @UniqueConstraint. Same annotations using hibernate works fine - an error will be thrown - duplicate name. ObjectDB - no exception will be thrown.
with best regards
Peter
import javax.persistence.*; public final class Test2 { public static void main(String[] args) { int r = (int)(Math.random() * 1000000); String PATH = "c:\\temp\\test_" + r + ".odb"; EntityManagerFactory emf = Persistence.createEntityManagerFactory(PATH); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); CI ci = new CI(); ci.name = "abc"; em.persist(ci); CI ci2 = new CI(); ci2.name = "abc"; em.persist(ci2); em.getTransaction().commit(); em.close(); System.out.println("OK: " + ci.id + " " + ci2.id); } @Entity @javax.persistence.Table(name="CI",uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME" }) }) public static final class CI { @Id @GeneratedValue long id; @Column(name="NAME", nullable=false) String name; } }