About unique

manual

Index Definition

Describes how to define indexes in JPA entity classes and explains how indexes are used in JPQL queries.... index. See JavaDoc Reference Page... and @Unique javax.jdo.annotations.Unique JDO annotation Annotation for a database unique constraint. ...

 
api-jdo

javax.jdo.annotations.Unique

Annotation for a database unique constraint.(Annotation of JDO)

 
forum_thread

Unique contraint with 2 members

I am trying to do the following: @javax.persistence.Entity public class Account { @Unique() private String name; @Unique(members={"SalesforceID","sport"}) private String SalesforceID; private String sport; ... } The first Unique contraint works. On commit, an exception is thrown if an Account already exists with the specified name. The second does not seem to work. I would expect an exception to be thrown if the combination of SalesforceID and sport is not unique. Am I doing this right? ... public class Account {   @ Unique ( ) private String name ;   @ Unique ( members = { "SalesforceID" , "sport" ...

 
forum_thread

@Unique member combination not working

Why does the below code not enforce unique restrictions?   Person.java ... Why does the below code not enforce unique restrictions?   Person @ Entity @ Unique ( members = { "name" , "surname" ...

 
forum_thread

How to create a Unique constraint?

Hi, I'm trying to create a unique constraint. Here is a simple example: @Entity public class Account { @Id @GeneratedValue private long id; @Index(unique="true") private String name; } The code runs and my Account objects are persisted. But no exception is thrown if name is the same. What do I need to do to have a Unique constraint? Thanks, Carl   ... Hi, I'm trying to create a unique constraint. Here is a simple example: @ Entity ... long id ;   @ Index ( unique = "true" ) private String name ; } ...

 
api-jdo

Index.unique

Whether this index is unique(Annotation Element of javax.jdo.annotations.Index)

 
issue

Unique Constraint Ignored

If i annotate a getter with: @Column(unique = true) it's simply ignored. If i use @Unique it works perfectly. ... a getter with: @ Column ( unique = true ) it's simply ignored. If i use @ Unique it works perfectly. ...

 
api-jdo

javax.jdo.annotations.Uniques

Annotation for a group of unique constraints.(Annotation of JDO)

 
forum_thread

@Unique added afterward is not taken into account

Hello, ... Hello, I encounter an issue with the @Unique annotation. The annotation was added on a given field itemID (String), ... were already added to the table). As a consequence the unique constraint is not taken into account when persisting an object which ...

 
forum_thread

Bug with unique constraint exception not resulting in transaction roll back

I'm using ObjectDB 2.5.6_02 and running into a bug with a JDO @Unique constraint.  I'm using JPA in general. I have an EJB persisting two entities with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) declared on the EJB method.  The two entities have the same value for the field with the @Unique constraint. The unique constraint causes an exception as expected, but I would expect ObjectDB to roll back the transaction and not persist anything.  However, it is persisting both entities. ... using ObjectDB 2.5.6_02 and running into a bug with a JDO @Unique constraint.  I'm using JPA in general. I have an EJB persisting ... two entities have the same value for the field with the @Unique constraint. The unique constraint causes an exception as ...