Unique constraint

918 views
Skip to first unread message

Emilian Stoilkov

unread,
Oct 8, 2012, 6:22:05 AM10/8/12
to gree...@googlegroups.com
Hi all,

First, thanks for the great framework.
I want to ask if it is currently possible to define an unique constraint over multiple columns using the dao generator? I realize that this is possible by just editing the create table statement in the generated files.

Thanks for your help.

yiğit boyar

unread,
Oct 8, 2012, 4:59:12 PM10/8/12
to gree...@googlegroups.com
you can create an index with multiple properties and unique constraint.

code will be sth like:
Index uniqIndex = new Index();
uniqIndex.addProperty(property1);
uniqIndex.addProperty(property2);
uniqIndex.makeUnique();
entity.addIndex(uniqIndex);
yigit

Emilian Stoilkov

unread,
Oct 19, 2012, 8:01:22 AM10/19/12
to gree...@googlegroups.com
Thanks

Kaz

unread,
Feb 14, 2017, 9:04:49 PM2/14/17
to greenDAO

Where or on which file do we need to add those line of codes?
Reply all
Reply to author
Forward
0 new messages