Examples of IntegerMapper


Examples of org.apache.torque.om.mapper.IntegerMapper

            throws TorqueException
    {
        Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
        Assert.assertEquals(new Integer(expected.size()),
                NonPkOIntegerFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (NonPkOIntegerFk nonPkOIntegerFk : expected)
        {
            criteria = NonPkOIntegerFkPeer.buildCriteria(nonPkOIntegerFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + nonPkOIntegerFk,
                    new Integer(1),
                    NonPkOIntegerFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
        }
    }
View Full Code Here

Examples of org.apache.torque.om.mapper.IntegerMapper

            throws TorqueException
    {
        Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
        Assert.assertEquals(new Integer(expected.size()),
                CompIntegerVarcharFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (CompIntegerVarcharFk compIntegerVarcharFk : expected)
        {
            criteria = CompIntegerVarcharFkPeer.buildCriteria(
                    compIntegerVarcharFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + compIntegerVarcharFk,
                    new Integer(1),
                    CompIntegerVarcharFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
        }
    }
View Full Code Here

Examples of org.apache.torque.om.mapper.IntegerMapper

            throws TorqueException
    {
        Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
        Assert.assertEquals(new Integer(expected.size()),
                NullableOIntegerFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (NullableOIntegerFk nullableOIntegerFk : expected)
        {
            criteria = NullableOIntegerFkPeer.buildCriteria(nullableOIntegerFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + nullableOIntegerFk,
                    new Integer(1),
                    NullableOIntegerFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
        }
    }
View Full Code Here

Examples of org.apache.torque.om.mapper.IntegerMapper

            throws TorqueException
    {
        Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
        Assert.assertEquals(new Integer(expected.size()),
                CompPkOtherFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (CompPkOtherFk compPkOtherFk : expected)
        {
            criteria = CompPkOtherFkPeer.buildCriteria(compPkOtherFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + compPkOtherFk,
                    new Integer(1),
                    CompPkOtherFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
        }
    }
View Full Code Here

Examples of org.apache.torque.om.mapper.IntegerMapper

            throws TorqueException
    {
        Criteria criteria = new Criteria().addSelectColumn(new Count("*"));
        Assert.assertEquals(new Integer(expected.size()),
                CompPkContainsFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (CompPkContainsFk compPkContainsFk : expected)
        {
            criteria = CompPkContainsFkPeer.buildCriteria(compPkContainsFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + compPkContainsFk,
                    new Integer(1),
                    CompPkContainsFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
        }
    }
View Full Code Here

Examples of org.skife.jdbi.v2.util.IntegerMapper

        h.begin();

        h.insert("insert into something (id, name) values (:id, :name)", 1, "Tom");
        h.checkpoint("first");
        h.insert("insert into something (id, name) values (:id, :name)", 1, "Martin");
        assertEquals(Integer.valueOf(2), h.createQuery("select count(*) from something").map(new IntegerMapper()).first());
        h.rollback("first");
        assertEquals(Integer.valueOf(1), h.createQuery("select count(*) from something").map(new IntegerMapper()).first());
        h.commit();
        assertEquals(Integer.valueOf(1), h.createQuery("select count(*) from something").map(new IntegerMapper()).first());
    }
View Full Code Here

Examples of org.skife.jdbi.v2.util.IntegerMapper

            fail("unexpected exception");
        }

        final Handle h = DBI.open(derby);

        int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();

        assertEquals(0, count);
        h.close();
    }
View Full Code Here

Examples of org.skife.jdbi.v2.util.IntegerMapper

                            public void call(IDBI inner)
                            {
                                final Handle h = DBIUtil.getHandle(inner);
                                h.insert("insert into something (id, name) values (8, 'ignored again')");

                                int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
                                assertEquals(2, count);
                                throw new ForceRollback();
                            }
                        });
                        fail("should have thrown an exception");
                    }
                    catch (ForceRollback e) {
                        assertTrue(true);
                    }
                    int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
                    assertEquals(1, count);
                    throw new ForceRollback();
                }
            });
            fail("should have thrown an exception");
        }
        catch (ForceRollback e) {
            assertTrue(true);
        }

        service.inPropagationRequired(new Callback()
        {
            public void call(IDBI dbi)
            {
                final Handle h = DBIUtil.getHandle(dbi);
                int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
                assertEquals(0, count);
            }
        });
    }
View Full Code Here

Examples of org.skife.jdbi.v2.util.IntegerMapper

                    service.inRequiresNewReadUncommitted(new Callback()
                    {
                        public void call(IDBI inner)
                        {
                            final Handle h = DBIUtil.getHandle(inner);
                            int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
                            assertEquals(1, count);
                            h.insert("insert into something (id, name) values (8, 'ignored again')");
                            throw new ForceRollback();
                        }
                    });
                }
                catch (ForceRollback e) {
                    assertTrue(true);
                }

                int count = h.createQuery("select count(*) from something").map(new IntegerMapper()).first();
                assertEquals(1, count);
            }
        });
    }
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.