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!
From stackoverflow
-
Which exception is thrown?
Can you post the call stack?
-
Hi Viet,
I ran the code snippet you posted with a simple NotyUser class (just a String username field) and no exception was thrown neither in db4o-7.12 in android 1.5, nor db4o trunk with android 2.1.
What exception was thrown there? and can you post the NotyUser class?
Viet : Hi Fabio! Thanks for addressing this old problem. I changed direction and adopted SQLite. I may come back for db4o. It'd be great if you'd share your piece of code. I'll accept it as the best answer. Thanks.
0 comments:
Post a Comment