@Unique doesn't have any effect in DataNucleus w/ NeoDatis

Posted by David Parks on Stack Overflow See other posts from Stack Overflow or by David Parks
Published on 2010-11-09T06:03:40Z Indexed on 2011/01/02 21:53 UTC
Read the original article Hit count: 177

Filed under:
|
|
|

Using JDO / DataNucleus / NeoDatis datastore

I added @Unique to a field of a persistable object, however I am allowed to create multiple objects which violate the unique constraint. The docs for DataNucleus/NeoDatis suggest that Unique fields are supported.

@PersistenceCapable
public class User {
 @Persistent
 @Unique
 private String username;
 //...
}

If I add multiple objects to the DB with the same username there's no problem doing so. :(

© Stack Overflow or respective owner

Related posts about java

Related posts about jdo