Search in sources :

Example 1 with BindQuickStartDaoFactory

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;
        }
    });
}
Also used : Comment(sqlite.quickstart.model.Comment) BindQuickStartDataSource(sqlite.quickstart.persistence.BindQuickStartDataSource) TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) User(sqlite.quickstart.model.User) Post(sqlite.quickstart.model.Post) BindQuickStartDaoFactory(sqlite.quickstart.persistence.BindQuickStartDaoFactory) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Aggregations

BaseAndroidTest (base.BaseAndroidTest)1 TransactionResult (com.abubusoft.kripton.android.sqlite.TransactionResult)1 Test (org.junit.Test)1 Comment (sqlite.quickstart.model.Comment)1 Post (sqlite.quickstart.model.Post)1 User (sqlite.quickstart.model.User)1 BindQuickStartDaoFactory (sqlite.quickstart.persistence.BindQuickStartDaoFactory)1 BindQuickStartDataSource (sqlite.quickstart.persistence.BindQuickStartDataSource)1