Search in sources :

Example 1 with DecimalPKTestEntity

use of org.apache.cayenne.testdo.numeric_types.DecimalPKTestEntity in project cayenne by apache.

the class NumericTypesIT method testDecimalPK.

@Test
public void testDecimalPK() throws Exception {
    // populate (testing insert as well)
    DecimalPKTestEntity object = context.newObject(DecimalPKTestEntity.class);
    object.setName("o1");
    object.setDecimalPK(new BigDecimal("1.25"));
    context.commitChanges();
    ObjectId syntheticId = new ObjectId("DecimalPKTestEntity", "DECIMAL_PK", new BigDecimal("1.25"));
    assertSame(object, context.getGraphManager().getNode(syntheticId));
    context.deleteObjects(object);
    context.commitChanges();
}
Also used : ObjectId(org.apache.cayenne.ObjectId) DecimalPKTestEntity(org.apache.cayenne.testdo.numeric_types.DecimalPKTestEntity) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

BigDecimal (java.math.BigDecimal)1 ObjectId (org.apache.cayenne.ObjectId)1 DecimalPKTestEntity (org.apache.cayenne.testdo.numeric_types.DecimalPKTestEntity)1 Test (org.junit.Test)1