Search in sources :

Example 1 with ShapeHolder4

use of org.jpox.samples.interfaces.ShapeHolder4 in project tests by datanucleus.

the class InterfacesTest method testMultipleImplWithMissingColumns.

/**
 * Test a scenario that all columns are declared for an interface field
 * that has ColumnMetaData specified for only 1 implementation.
 */
public void testMultipleImplWithMissingColumns() throws Exception {
    try {
        PersistenceManager pm = pmf.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        try {
            // Create container and some shapes
            tx.begin();
            ShapeHolder4 holder = new ShapeHolder4(101);
            Circle circle = new Circle(1, 102.0);
            holder.setShape1(circle);
            pm.makePersistent(holder);
            tx.commit();
            fail("Expected exception, for wrong declared columns");
        } catch (Exception e) {
        // Do nothing
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
            pm.close();
        }
    } finally {
    }
}
Also used : ShapeHolder4(org.jpox.samples.interfaces.ShapeHolder4) Circle(org.jpox.samples.interfaces.Circle) Shape5Circle(org.jpox.samples.interfaces.Shape5Circle) Transaction(javax.jdo.Transaction) PersistenceManager(javax.jdo.PersistenceManager) JDOUserException(javax.jdo.JDOUserException)

Aggregations

JDOUserException (javax.jdo.JDOUserException)1 PersistenceManager (javax.jdo.PersistenceManager)1 Transaction (javax.jdo.Transaction)1 Circle (org.jpox.samples.interfaces.Circle)1 Shape5Circle (org.jpox.samples.interfaces.Shape5Circle)1 ShapeHolder4 (org.jpox.samples.interfaces.ShapeHolder4)1