One-To-Many relationship in ORMLite Android

后端 未结 3 812
滥情空心
滥情空心 2021-02-08 09:53

How do I implement one-many relationship in ORMLite Android?

please find the example

public class A {
 private String name;
    @DatabaseField (foreign =         


        
3条回答
  •  深忆病人
    2021-02-08 10:23

    Now i create dao of b, since b has all the data. But the table B has only created with data, A is never created. Kindly could some one help?

    Right. You need to create the A items using:

    for (A a : b.aees) {
       aDao.create(a);
    }
    

    ORMLite does not automatically create those for you.

    You might take a look a the source code of the foreign-collection example program.

提交回复
热议问题