Package org.nutz.trans

Examples of org.nutz.trans.Atom


        });
    }

    @Test
    public void delete_null_field_links_partly() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Platoon p = dao.fetchLinks(dao.fetch(Platoon.class), "tanks|soliders");
                p.getTanks().remove("M1-A1");
                p.getSoliders().remove(0);
                dao.deleteLinks(p, "tanks|soliders");
View Full Code Here


        });
    }

    @Test
    public void delete_with() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Soldier s = dao.fetchLinks(dao.fetch(Soldier.class, "ZZH"), "guns");
                dao.deleteWith(s, "guns");
                assertEquals(4, dao.count(Soldier.class));
                assertEquals(8, dao.count(Gun.class));
View Full Code Here

        });
    }

    @Test
    public void delete_with_partly() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Soldier s = dao.fetchLinks(dao.fetch(Soldier.class, "ZZH"), "guns");
                s.getGuns()[1] = null;
                dao.deleteWith(s, "guns");
                assertEquals(4, dao.count(Soldier.class));
View Full Code Here

        });
    }

    @Test
    public void clear_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Soldier s = dao.fetch(Soldier.class, "ZZH");
                dao.clearLinks(s, "guns");
                assertEquals(5, dao.count(Soldier.class));
                assertEquals(8, dao.count(Gun.class));
View Full Code Here

        });
    }

    @Test
    public void clear_null_field_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Platoon p = dao.fetch(Platoon.class);
                dao.clearLinks(p, "tanks|soliders");
                assertEquals(1, dao.count(Platoon.class));
                /*
 
View Full Code Here

        });
    }

    @Test
    public void update_links() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Soldier s = dao.fetchLinks(dao.fetch(Soldier.class, "ZZH"), "guns");
                s.setAge(25);
                s.getGuns()[0].setType(Gun.TYPE.AK47);
                s.getGuns()[1].setType(Gun.TYPE.AK47);
View Full Code Here

        });
    }

    @Test
    public void update_with() {
        TableName.run(platoon, new Atom() {
            public void run() {
                Soldier s = dao.fetchLinks(dao.fetch(Soldier.class, "ZZH"), "guns");
                s.setAge(25);
                s.getGuns()[0].setType(Gun.TYPE.AK47);
                s.getGuns()[1].setType(Gun.TYPE.AK47);
View Full Code Here

    public void test_update_ignore_null() {
        dao.create(Pet.class, true);
        final Pet pet = Pet.create("XiaoBai").setAge(20);
        dao.insert(pet);

        FieldFilter.create(Pet.class, true).run(new Atom() {
            public void run() {
                Pet p1 = new Pet().setAge(12).setId(pet.getId());
                dao.update(p1);
            }
        });
View Full Code Here

        p.setLeaderName("ABC");
        dao.update(p);
        p = dao.fetch(Platoon.class, "sF");
        assertEquals("ABC", p.getLeaderName());

        FieldFilter.create(Platoon.class, true).run(new Atom() {

            public void run() {
                System.out.println(FieldFilter.get(Platoon.class));
                Platoon p = dao.fetch(Platoon.class, "sF");
                p.setLeaderName(null);
View Full Code Here

    public Platoon create4Platoon(Base base, String name) {
        final Platoon p = dao().insert(Platoon.make(base, name));
        int id = p.getId();
        initPlatoon(id);
        TableName.run(id, new Atom() {
            public void run() {
                Soldier mick = Soldier.make("Mick");
                Soldier zzh = Soldier.make("ZZH");
                Soldier peter = Soldier.make("Peter");
                Soldier sm = Soldier.make("Super Man");
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.