Setting unique key constraint for Db4oEmbedded EmbeddedConfiguration
- by Viet
Hi, I want to set unique key constraint for Db4oEmbedded EmbeddedConfiguration.
Here goes my code:
EmbeddedConfiguration myConf = Db4oEmbedded.newConfiguration();
myConf.common().objectClass(NotyUser.class).objectField("username").indexed(true);
myConf.common().add(new com.db4o.constraints.UniqueFieldValueConstraint(NotyUser.class, "username"));
The last line throws exception. I don't know why. I'm running Android SDK 1.5 and db4o 7.12 for Java. Please kindly advise. Thanks!