Examples of Prefname


Examples of org.netbeans.modules.exceptions.entity.Prefname

    @Test
    public void testPersistable() throws Exception {
        Persistable persist = new Persistable.Transaction() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = new Prefname("name1");
                em.persist(name);
                id = name.getId();
                return TransactionResult.COMMIT;
            }
        };
        Utils.processPersistable(persist);

        Persistable query = new Persistable.Query() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = em.find(Prefname.class, id);
                assertNotNull(name);
                dataFoundInDb = true;
                return TransactionResult.NONE;
            }
        };
View Full Code Here

Examples of org.netbeans.modules.exceptions.entity.Prefname

    @Test
    public void testRollback() throws Exception {
        Persistable persist = new Persistable.Transaction() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = new Prefname("name1");
                em.persist(name);
                id = name.getId();
                return TransactionResult.ROLLBACK;
            }
        };
        Utils.processPersistable(persist);

        Persistable query = new Persistable.Query() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = em.find(Prefname.class, id);
                assertNull(name);
                dataFoundInDb = false;
                return null;
            }
        };
View Full Code Here

Examples of org.netbeans.modules.exceptions.entity.Prefname

   
    public void testExceptionDelegation(){
        Persistable persist = new Persistable.Transaction() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = new Prefname("name1");
                em.persist(name);
                id = name.getId();
                String str = null;
                str.charAt(0)// NPE
                return TransactionResult.COMMIT;
            }
        };
        try{
            Utils.processPersistable(persist);
            fail("PersistanceException should be thrown");
        }catch(PersistenceException exc){
            // OK
            assertTrue(exc.getCause() instanceof NullPointerException);
        }

        Persistable query = new Persistable.Query() {

            public TransactionResult runQuery(EntityManager em) {
                Prefname name = em.find(Prefname.class, id);
                assertNull(name);
                dataFoundInDb = false;
                return null;
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.