Package org.nutz.trans

Examples of org.nutz.trans.Atom


        });
    }

    @Test
    public void clear_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Tank t = dao.fetch(Tank.class, "M1-A1");
                dao.clearLinks(t, "motorman");
                assertEquals(4, dao.count(Soldier.class));
                assertEquals(2, dao.count(Tank.class));
View Full Code Here


        });
    }

    @Test
    public void update_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Tank t = dao.fetchLinks(dao.fetch(Tank.class, "M1-A1"), "motorman");
                t.getMotorman().setAge(32);
                dao.updateLinks(t, "motorman");
                Soldier s = dao.fetch(Soldier.class, t.getMotorName());
View Full Code Here

        });
    }

    @Test
    public void update_with() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Tank t = dao.fetchLinks(dao.fetch(Tank.class, "M1-A1"), "motorman");
                t.getMotorman().setAge(32);
                t.setWeight(50);
                dao.updateWith(t, "motorman");
View Full Code Here

            sql = dao.sqls().create("tank.insert");
            sql.vars().set("id", platoonId);
            sql.params().set("code", "T4").set("weight", 15);
            dao.execute(sql);

            TableName.run(platoonId, new Atom() {
                public void run() {
                    assertEquals(4, dao.count(Tank.class));
                }
            });
        }
View Full Code Here

    protected void after() {}

    private Cat insert(final Cat cat, final Bomb bomb) {
        // //System.out.printf("\n>> insert cat: %d\n",
        // bomb.times);
        Trans.exec(new Atom() {
            public void run() {
                dao.insert(cat);
                cat.setMaster(insert(cat.getMaster(), bomb));
                bomb.bong();
            }
View Full Code Here

    }

    private Company insert(final Company com, final Bomb bomb) {
        // //System.out.printf("\n>> insert company: %d\n",
        // bomb.times);
        Trans.exec(new Atom() {
            public void run() {
                dao.insert(com);
                bomb.bong();
            }
        });
View Full Code Here

    }

    private Master insert(final Master master, final Bomb bomb) {
        // //System.out.printf("\n>> insert master: %d\n",
        // bomb.times);
        Trans.exec(new Atom() {
            public void run() {
                dao.insert(master);
                master.setCom(insert(master.getCom(), bomb));
                bomb.bong();
            }
View Full Code Here

    @Test
    public void testRollback() {
        // In transaction
        try {
            Trans.exec(new Atom() {
                public void run() {
                    Company com = Company.create("dtri");
                    Master m = Master.create("zzh", com);
                    Cat c1 = Cat.create("XiaoBai", m);
                    Cat c2 = Cat.create("Tony", m);
View Full Code Here

        private Object checker;
        private Object tellor;
        public Object waiter;

        public void run() {
            Trans.exec(new Atom() {
                public void run() {
                    // System.out.println("\nI am another");
                    Company com = Company.create("dtri");
                    Master m = Master.create("zzh", com);
                    Cat c1 = Cat.create("XiaoBai", m);
View Full Code Here

        pojos.dropPlatoon(p.getId());
    }

    @Test
    public void delete_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Tank t = dao.fetchLinks(dao.fetch(Tank.class, "T92"), "members");
                assertEquals(3, t.getMembers().size());
                dao.deleteLinks(t, "members");
                assertEquals(2, dao.count(Soldier.class));
View Full Code Here

TOP

Related Classes of org.nutz.trans.Atom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.