When I made a table from a model with a combination of Iciql + SQLite, I had a hard time setting a composite primary key, so I will share information.
See here. http://iciql.com/
· Java version ... 8 ・ Version of iciql ... iciql-2.2.1 -Sqlite jdbc driver ... sqlite-jdbc-3.8.11.2.jar
Set the decryption key as follows. (Set the field name connected by commas in primaryKey)
@IQTable(name = "model", primaryKey= "field1,field2" )
public class Model {
@IQColumn(name = "field1")
public String field1;
@IQColumn(name = "field2")
public int field2;
@IQColumn(name = "value")
public String value;
}
When I did this, the primary key was set only in field2. (Set the field name in primaryKey as an array)
@IQTable(name = "model", primaryKey={"field1","field2"} )
public class Model {
@IQColumn(name = "field1")
public String field1;
@IQColumn(name = "field2")
public int field2;
@IQColumn(name = "value")
public String value;
}
Again, the primary key was set only in field2. (Set true for each primaryKey of @IQColumn)
@IQTable(name = "model")
public class Model {
@IQColumn(name = "field1", primaryKey=true)
public String field1;
@IQColumn(name = "field2", primaryKey=true)
public int field2;
@IQColumn(name = "value")
public String value;
}
With postgres (*), both of the above bad examples 1 and 2 work as intended. We have not verified other DBs.
*) The version of postgres is 9.6, and the jdbc driver uses postgresql-9.4.1211.jar.
Recommended Posts