I created database, for my android app, witch has 16 tables. I want to use ORMlite mapping. The problem is that I didn't find examples where you have composite id(Multiple primary keys). For example I have table:
CREATE TABLE IF NOT EXISTS `Tourist_Guide`.`Cultural_activity` (
`City_Id` INT NOT NULL ,
`activity_Id` INT NOT NULL ,
`Cultural_activity_Id` INT NOT NULL AUTO_INCREMENT ,
`Name_Of_Cultural_activity` VARCHAR(30) NOT NULL ,
PRIMARY KEY (`Cultural_activity_Id`, `City_Id`, `activity_Id`) ,
INDEX `fk_Cultural_activity_activity1` (`City_Id` ASC, `activity_Id` ASC) ,
CONSTRAINT `fk_Cultural_activity_activity1`
FOREIGN KEY (`City_Id` , `activity_Id` )
REFERENCES `Tourist_Guide`.`activity` (`City_Id` , `activity_Id` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
Can you, please, tell me how to map this table to class(how this class should look like), is that even possible?
You have to use the following annotation above each unique field:
@DatabaseField (uniqueCombo = true)