Search in sources :

Example 21 with SingleTableSubclass

use of org.hibernate.mapping.SingleTableSubclass in project jbosstools-hibernate by jbosstools.

the class PersistentClassFacadeTest method testIsAssignableToRootClass.

@Test
public void testIsAssignableToRootClass() {
    persistentClassTarget = new SingleTableSubclass(new RootClass());
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
    assertFalse(persistentClassFacade.isAssignableToRootClass());
    persistentClassTarget = new RootClass();
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
    assertTrue(persistentClassFacade.isAssignableToRootClass());
}
Also used : RootClass(org.hibernate.mapping.RootClass) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) Test(org.junit.jupiter.api.Test)

Example 22 with SingleTableSubclass

use of org.hibernate.mapping.SingleTableSubclass in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewSingleTableSubclass.

@Test
public void testNewSingleTableSubclass() {
    IPersistentClass persistentClass = service.newRootClass();
    IPersistentClass singleTableSublass = service.newSingleTableSubclass(persistentClass);
    assertNotNull(singleTableSublass);
    Object target = ((IFacade) singleTableSublass).getTarget();
    assertNotNull(target);
    assertTrue(target instanceof SingleTableSubclass);
    assertSame(persistentClass, singleTableSublass.getSuperclass());
    assertSame(((IFacade) persistentClass).getTarget(), ((SingleTableSubclass) target).getSuperclass());
}
Also used : IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 23 with SingleTableSubclass

use of org.hibernate.mapping.SingleTableSubclass in project jbosstools-hibernate by jbosstools.

the class PersistentClassFacadeTest method testIsAssignableToRootClass.

@Test
public void testIsAssignableToRootClass() {
    persistentClassTarget = new SingleTableSubclass(new RootClass(null), null);
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
    assertFalse(persistentClassFacade.isAssignableToRootClass());
    persistentClassTarget = new RootClass(null);
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, persistentClassTarget);
    assertTrue(persistentClassFacade.isAssignableToRootClass());
}
Also used : RootClass(org.hibernate.mapping.RootClass) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) Test(org.junit.jupiter.api.Test)

Example 24 with SingleTableSubclass

use of org.hibernate.mapping.SingleTableSubclass in project hibernate-orm by hibernate.

the class ModelBinder method bindDiscriminatorSubclassEntities.

private void bindDiscriminatorSubclassEntities(AbstractEntitySourceImpl entitySource, PersistentClass superEntityDescriptor) {
    for (IdentifiableTypeSource subType : entitySource.getSubTypes()) {
        final SingleTableSubclass subEntityDescriptor = new SingleTableSubclass(superEntityDescriptor, metadataBuildingContext);
        bindDiscriminatorSubclassEntity((SubclassEntitySourceImpl) subType, subEntityDescriptor);
        superEntityDescriptor.addSubclass(subEntityDescriptor);
        entitySource.getLocalMetadataBuildingContext().getMetadataCollector().addEntityBinding(subEntityDescriptor);
    }
}
Also used : IdentifiableTypeSource(org.hibernate.boot.model.source.spi.IdentifiableTypeSource) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass)

Example 25 with SingleTableSubclass

use of org.hibernate.mapping.SingleTableSubclass in project hibernate-orm by hibernate.

the class PersistentClassVisitorTest method testProperCallbacks.

@Test
public void testProperCallbacks() {
    PersistentClassVisitorValidator vv = new PersistentClassVisitorValidator();
    new RootClass(metadataBuildingContext).accept(vv);
    new Subclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
    new JoinedSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
    new SingleTableSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
    new UnionSubclass(new RootClass(metadataBuildingContext), metadataBuildingContext).accept(vv);
}
Also used : RootClass(org.hibernate.mapping.RootClass) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) UnionSubclass(org.hibernate.mapping.UnionSubclass) Subclass(org.hibernate.mapping.Subclass) UnionSubclass(org.hibernate.mapping.UnionSubclass) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) Test(org.junit.Test)

Aggregations

SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)46 Test (org.junit.jupiter.api.Test)33 RootClass (org.hibernate.mapping.RootClass)23 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)22 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)21 PersistentClass (org.hibernate.mapping.PersistentClass)11 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)11 IdentifiableTypeSource (org.hibernate.boot.model.source.spi.IdentifiableTypeSource)1 JoinedSubclass (org.hibernate.mapping.JoinedSubclass)1 Subclass (org.hibernate.mapping.Subclass)1 UnionSubclass (org.hibernate.mapping.UnionSubclass)1 Test (org.junit.Test)1