use of sqlite.feature.schema.version2.Professor in project kripton by xcesco.
the class TestSchemaRuntime method testRun.
@Test
public void testRun() {
BindSchoolDataSource.build(DataSourceOptions.builder().databaseLifecycleHandler(new DatabaseLifecycleHandler() {
@Override
public void onUpdate(SQLiteDatabase db, int oldVersion, int newVersion, boolean upgrade) {
// TODO Auto-generated method stub
}
@Override
public void onCreate(SQLiteDatabase database) {
// TODO Auto-generated method stub
}
@Override
public void onConfigure(SQLiteDatabase database) {
// TODO Auto-generated method stub
}
}).build());
try (BindSchoolDataSource dataSource = BindSchoolDataSource.open();
DaoProfessorImpl dao = dataSource.getDaoProfessor()) {
// dataSource.execute(transaction);
for (int i = 0; i < 10; i++) {
Professor professor = new Professor();
professor.name = String.format("professor%03d", i);
professor.surname = "surname" + i;
professor.birthDate = new Date();
dao.insert(professor);
}
}
try (BindSchoolDataSource dataSource = BindSchoolDataSource.open();
DaoStudentImpl dao = dataSource.getDaoStudent()) {
// dataSource.execute(transaction);
for (int i = 0; i < 100; i++) {
Student student = new Student();
student.name = String.format("professor%03d", i);
student.location = String.format("location%03d", i);
dao.insert(student);
}
}
}
Aggregations