use of sqlite.quickstart.persistence.BindQuickStartDaoFactory in project kripton by xcesco.
the class TestQuickstartRuntime method testRunSqlite1.
@Test
public void testRunSqlite1() {
BindQuickStartDataSource dataSource = BindQuickStartDataSource.instance();
dataSource.execute(new BindQuickStartDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindQuickStartDaoFactory daoFactory) {
User user = new User();
user.id = 1;
user.name = "user";
user.username = "username";
daoFactory.getUserDao().insert(user);
Post post = new Post();
post.id = 2;
post.title = "post";
post.userId = user.id;
daoFactory.getPostDao().insert(post);
Comment comment = new Comment();
comment.id = 3;
comment.postId = post.id;
daoFactory.getCommentDao().insert(comment);
return TransactionResult.COMMIT;
}
});
}
Aggregations