About unique

21-30 of 145Refresh
Manual
53

Index Definition

@Index and @Unique annotations to define indexes: import javax.jdo.annotations.Index; import javax.jdo.annotations.Unique; @Entity public class EntityWithSimpleIndex { @Index String indexedField1; @Index(unique="true") int indexedField2; // unique @Index(name="i3") int indexedField3
Forum
20

@Unique member combination not working

Why does the below code not enforce unique restrictions?   Person @Entity @Unique(members ...     @Unique(members = {"name", "surname"})     public static class Person implements Serializable ... : Unique constraint (com.objectdb.test.bug.forum.T1522$Person[name,surname]) failed: Attempt to reuse
Issue
20

Can not have unique index on Byte Array

I found that it is impossible to insert a record with @Unique byte[] var; after initial insertion ... transaction: Unique constraint (id.co.ecoin.test.objectdb.ObjectDbTest$OdbByteArray[key]) failed ... .PersistenceException: com.objectdb.o.UserException: Unique constraint (id.co.ecoin.test.objectdb.ObjectDbTest
Forum
19

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 ... if name is the same. What do I need to do to have a Unique constraint? Thanks, Carl   On a hunch, I
Forum
19

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 constraint works. On commit, an exception is thrown
Forum
19

@Unique added afterward is not taken into account

Hello, I encounter an issue with the @Unique annotation. The annotation was added on a given field ... were already added to the table). As a consequence the unique constraint is not taken into account when persisting ... scheme for all entities). So the question is simple, is there a better way to "re-activate" the @Unique
Forum
18

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 ... with the @Unique constraint. The unique constraint causes an exception as expected, but I would expect
Issue
18

Unique Constraint Ignored

If i annotate a getter with: @Column(unique = true) it's simply ignored. If i use @Unique it works perfectly. Usually ObjectDB silently ignores ORM annotations. This is not a bug ... unique by using the @Column annotation is now supported (starting build 2.3.2_04). mosi0815
Issue
18

NoResultException: No matching results for a unique query

I am very often getting a "com.objectdb.o._NoResultException: No matching results for a unique query" when modifying my already persisted entities within a transaction. I cannot replicate it however because it happens infrequently. The weird thing is that the entity nevertheless gets comitted
JDO Doc
16

JDO Predefined ID Classes

An object ID is a combination of a persistence capable class and a primary key. It provides a unique representation of a persistent object. The following classes serve as predefined ID classes ... instances of MyClass) can be represented uniquely by StringIdentity, as a combination of a class and a string value.