Package org.apache.torque.om

Examples of org.apache.torque.om.ObjectKey


     */
    public void testGetForeignKeyForObjectIntNotZero() throws Exception
    {
        NullableOIntegerFk nullableOIntegerFk = new NullableOIntegerFk();
        nullableOIntegerFk.setFk(3);
        ObjectKey foreignKey = nullableOIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(3), foreignKey);
    }
View Full Code Here


     */
    public void testGetForeignKeyForDefaultedObjectIntNull() throws Exception
    {
        OIntegerFkWithDefault oIntegerFk = new OIntegerFkWithDefault();
        oIntegerFk.setFk(null);
        ObjectKey foreignKey = oIntegerFk.getForeignKeyForOIntegerPk();
        assertNull(foreignKey.getValue());
    }
View Full Code Here

     */
    public void testGetForeignKeyForDefaultedObjectIntZero() throws Exception
    {
        OIntegerFkWithDefault oIntegerFk = new OIntegerFkWithDefault();
        oIntegerFk.setFk(0);
        ObjectKey foreignKey = oIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(0), foreignKey);
    }
View Full Code Here

     */
    public void testGetForeignKeyForDefaultedObjectIntDefault() throws Exception
    {
        OIntegerFkWithDefault oIntegerFk = new OIntegerFkWithDefault();
        oIntegerFk.setFk(2);
        ObjectKey foreignKey = oIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(2), foreignKey);
    }
View Full Code Here

     */
    public void testGetForeignKeyForDefaultedObjectIntNotZero() throws Exception
    {
        OIntegerFkWithDefault oIntegerFk = new OIntegerFkWithDefault();
        oIntegerFk.setFk(3);
        ObjectKey foreignKey = oIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(3), foreignKey);
    }
View Full Code Here

     *         rethrown wrapped into a TorqueException.
     */
    protected T putInstanceImpl(T om)
        throws TorqueException
    {
        ObjectKey key = om.getPrimaryKey();
        return putInstanceImpl(key, om);
    }
View Full Code Here

        }
        Connection connection = null;
        try
        {
            connection = Transaction.begin(databaseNameFromInsertValues);
            ObjectKey id = doInsert(insertValues, connection);
            Transaction.commit(connection);
            connection = null;
            return id;
        }
        finally
View Full Code Here

                = getNullableOIntegerFkList();
        assertEquals(4, nullableOIntegerFkList.size());
        assertTrue(nullableOIntegerFkList.contains(toDelete));

        // calculate and check primary key
        ObjectKey primaryKey = toDelete.getPrimaryKey();
        assertTrue(primaryKey instanceof NumberKey);
        assertEquals(new BigDecimal(preDeleteId), primaryKey.getValue());

        // call delete method and check result.
        int deleted = NullableOIntegerFkPeer.doDelete(primaryKey);
        assertEquals(1, deleted);
        assertEquals(preDeleteId, toDelete.getId().intValue());
View Full Code Here

                = getNullableOIntegerFkList();
        assertEquals(4, nullableOIntegerFkList.size());
        assertFalse(nullableOIntegerFkList.contains(toDelete));

        // calculate and check primary key
        ObjectKey primaryKey = toDelete.getPrimaryKey();
        assertTrue(primaryKey instanceof NumberKey);
        assertEquals(new BigDecimal(preDeleteId), primaryKey.getValue());

        // call delete method and check result.
        int deleted = NullableOIntegerFkPeer.doDelete(primaryKey);
        assertEquals(0, deleted);
        assertEquals(preDeleteId, toDelete.getId().intValue());
View Full Code Here

     *
     * @return an <code>int</code> value
     */
    public int hashCode()
    {
        ObjectKey ok = getPrimaryKey();
        if (ok == null)
        {
            return super.hashCode();
        }

        return ok.hashCode();
    }
View Full Code Here

TOP

Related Classes of org.apache.torque.om.ObjectKey

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.