ahmetalpbalkan/orman — Issue #36: Issue creating one-to-many relationship with Id autoincrement
Author: Antpachon
Created: 2011-10-24 08:37:26+00:00
State: open

Hi.

I'm trying to create a one-to-many relationship just like in the wiki example.

These are my class:

@Entity
public class CadenaDBO extends Model {

@PrimaryKey(autoIncrement=true)
public long id;

private String uid;

private String medioRef;

private String title;

private String permalink;

@OneToMany(toType = ProgramaDBO.class, onField = "channel")
public EntityList programas = new EntityList(CadenaDBO.class, ProgramaDBO.class, this);
.
.

}

@Entity
public class ProgramaDBO extends Model {

@PrimaryKey(autoIncrement=true)
public long id;

private String uid;

private String name;

private String permalink;

private String language;

@ManyToOne
private CadenaDBO channel;

Like in the wiki example but when I try to insert an element, first in CadenaDBO I'm getting a error column uid not unique.

I'm creating an Object and then I execute objectCadena.insert()

I can see the error in DDMS and the query is : INSTER INTO cadena_dbo (permalink, uid, title, medioref) VALUES .....

Where is the long id column with autoincrement???