use of sqlite.feature.many2many.case7.CityPerson in project kripton by xcesco.
the class TestRuntimeMany2Many7 method testMany2Many.
/**
* Test many 2 many.
*
* @throws InterruptedException
* the interrupted exception
*/
@Test
public void testMany2Many() throws InterruptedException {
BindAppDataSource ds = BindAppDataSource.getInstance();
ds.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindAppDaoFactory daoFactory) {
List<City> cities = new ArrayList<City>();
List<Person> persons = new ArrayList<Person>();
CityDaoImpl cityDao = daoFactory.getCityDao();
PersonDaoImpl personDao = daoFactory.getPersonDao();
City2PersonDaoImpl m2mDao = daoFactory.getCity2PersonDao();
// insert city
for (int i = 0; i < 1; i++) {
City bean = new City();
bean.name = "city" + i;
cityDao.insert(bean);
cities.add(bean);
}
// insert person
for (int i = 0; i < 1; i++) {
Person bean = new Person();
bean.name = "person" + i;
personDao.insert(bean);
persons.add(bean);
}
{
// m2m
CityPerson bean = new CityPerson(0, cities.get(0).id, persons.get(0).id);
m2mDao.insert(bean);
}
return TransactionResult.COMMIT;
}
});
}
Aggregations