0
votes

I use the ORMLite Poco generator for my database.

The problem is that I have a table with multiple primary keys, and when I try to add any data into the database I get unique constraints.

I have read that I use @DatabaseField (uniqueCombo = true) but I have no idea where to add that. Please help me

This is my code in Poco class generator and all of the fields below are part of the primary key.

    tables["FieldLookupGroupFieldLookup"].Ignore = false;
tables["FieldLookupGroupFieldLookup"].ClassName = "CustomFieldGroupRelation";
tables["FieldLookupGroupFieldLookup"]["FieldLookupId"].PropertyName="CustomFieldValueId";
tables["FieldLookupGroupFieldLookup"]["ApplicationId"].PropertyName="CompanyId";
tables["FieldLookupGroupFieldLookup"]["FieldLookupGroupId"].PropertyName="GroupId";
2
Possible duplicate of How to use multiple primary keys - Flimzy

2 Answers

0
votes

Solved it by it by adding new field for ID

[AutoIncrement] public int Id { get; set; }

See here

Multiple primary keys - ORMlite