1

For one to Many relationship how can i define foreign key constraint. I did all the available solution but still facing the issue of no foreign key. Does Green-Dao support foreign key constraint ? if it is not support yer than how to use relationship, is it worth to create such ORM based relation ship with Green-Dao. Its not saving other entity object inside the parent entity like Hibernet. Please share some dummy code snippet to achieve this feature.

Thanks in Advance.

jayesh
  • 11
  • 6

1 Answers1

0

GreenDAO does not create foreign key nor cascade rules when you define relations. The relation exist just in the greenDaoModel

GreenDao Relations

@Entity
public class Order {

    @Id private Long id;
    private long customerId;

    @ToOne(joinProperty = "customerId")
    private Customer customer;
}

@Entity
public class Customer {
    @Id private Long id;
}
miv
  • 339
  • 4
  • 7