no9
7:39 AM
hello :)
 
Hai :)
 
no9
a basic question (i didnt want to write on SO)
how do i set multiple PKs
@DatabaseField(generatedId = true)
int id;
@DatabaseField (index = true, unique = true)
int tileMap_unique_id;
@DatabaseField (index = true)
int tileMap_level_id;
@DatabaseField (index = true)
int column;
@DatabaseField (index = true)
int row;
@DatabaseField (index = true)
Blob image_data;
@DatabaseField (index = true)
long image_data_lenght;
@DatabaseField(index = true)
Date date_created;
@DatabaseField(index = true)
Date date_last_accessed;
i want tileMap_unique_id, tileMap_level_id, column, row to be PK
is @DatabaseField(uniqueIndexName = "some_name") the correct way?
 
@no9 sorry not tried anything like that :(
but i think you right
did you tried that ?
 
no9
it sucks, because android does not have some GUI (like visual studio) where i can see relations in graphical way
not yet ... i will have to insert some dummy data to check
i hate this kind of testing :)
 
@no9 yea its very difficult to design complex dbs in android
Anyway it not a basic question you can post SO
 
no9
7:44 AM
1
Q: How to do multiple column unique-constraint in ormlite ( SQLite )

PzannoI'm using ormlite for Android and I'm trying to get a multiple column unique-constraint. As of now i'm only able to get a unique constraint on indiviudal columns like this: CREATE TABLE `store_group_item` (`store_group_id` INTEGER NOT NULL UNIQUE , `store_item_id` INTEGER NOT NULL UNIQUE , `_id`...

i found this one
i think its waht im asking
 
waw congrats you got and you are right :)
great
 
no9
now i wonder if having "@DatabaseField(generatedId = true)" would "fight" with that
since this line is ment to be the PK (in OrmLite documentation)
 
yea It will be the primary key. you cannot change it anyway
by setting that you can make it unique
there combination will be unique in your table
 
no9
so best in my case is not to have @Id field since i want to generate PK from several other fields?
 
yes
multiple PKs is not possible one relation one pk
but you can make a composite key
this @DatabaseField(uniqueIndexName = "some_name") with different field can be used to make that combination unique in your table
 
no9
7:53 AM
i will try with the solution from that question. Then i will try to break the PK by inserting something
 
its value combination will be unique through out your table
@no9 yea go with that :)
 
no9
great lets hope so :)
thank you @LabeebP for your time
 
@no9 np :) good luck