Search in sources :

Example 1 with BasicTypeImpl

use of org.eclipse.persistence.internal.jpa.metamodel.BasicTypeImpl in project eclipselink by eclipse-ee4j.

the class MetamodelMetamodelTest method testBasicType.

public void testBasicType() {
    EntityManager em = null;
    boolean exceptionThrown = false;
    try {
        em = privateTestSetup();
        assertNotNull(em);
        Metamodel metamodel = em.getMetamodel();
        assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
        // This interface is empty - however we can test BasicTypeImpl INTERNAL functionality
        // Test lazy creation of random basic types
        TypeImpl aRandomType = ((MetamodelImpl) metamodel).getType(Integer.class);
        assertEquals(Type.PersistenceType.BASIC, aRandomType.getPersistenceType());
        BasicTypeImpl aRandomBasicType = (BasicTypeImpl) aRandomType;
        assertFalse(aRandomBasicType.isEntity());
        assertFalse(aRandomBasicType.isMappedSuperclass());
    } catch (IllegalArgumentException iae) {
        iae.printStackTrace();
        exceptionThrown = true;
    } finally {
        cleanup(em);
        assertFalse("An IAE exception should not occur here.", exceptionThrown);
    }
}
Also used : EntityManager(jakarta.persistence.EntityManager) MetamodelImpl(org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl) BasicTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.BasicTypeImpl) Metamodel(jakarta.persistence.metamodel.Metamodel) MappedSuperclassTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.MappedSuperclassTypeImpl) TypeImpl(org.eclipse.persistence.internal.jpa.metamodel.TypeImpl) EmbeddableTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl) BasicTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.BasicTypeImpl) EntityTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl) ManagedTypeImpl(org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl)

Aggregations

EntityManager (jakarta.persistence.EntityManager)1 Metamodel (jakarta.persistence.metamodel.Metamodel)1 BasicTypeImpl (org.eclipse.persistence.internal.jpa.metamodel.BasicTypeImpl)1 EmbeddableTypeImpl (org.eclipse.persistence.internal.jpa.metamodel.EmbeddableTypeImpl)1 EntityTypeImpl (org.eclipse.persistence.internal.jpa.metamodel.EntityTypeImpl)1 ManagedTypeImpl (org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl)1 MappedSuperclassTypeImpl (org.eclipse.persistence.internal.jpa.metamodel.MappedSuperclassTypeImpl)1 MetamodelImpl (org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl)1 TypeImpl (org.eclipse.persistence.internal.jpa.metamodel.TypeImpl)1