Search in sources :

Example 1 with SingleTableSubclass

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

the class ServiceImpl method newSingleTableSubclass.

@Override
public IPersistentClass newSingleTableSubclass(IPersistentClass persistentClass) {
    assert persistentClass instanceof IFacade;
    IPersistentClass result = facadeFactory.createPersistentClass(new SingleTableSubclass((PersistentClass) ((IFacade) persistentClass).getTarget(), null));
    ((AbstractPersistentClassFacade) result).setSuperClass(persistentClass);
    return result;
}
Also used : AbstractPersistentClassFacade(org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 2 with SingleTableSubclass

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

the class ServiceImpl method newSingleTableSubclass.

@Override
public IPersistentClass newSingleTableSubclass(IPersistentClass persistentClass) {
    assert persistentClass instanceof IFacade;
    IPersistentClass result = facadeFactory.createPersistentClass(new SingleTableSubclass((PersistentClass) ((IFacade) persistentClass).getTarget(), null));
    ((AbstractPersistentClassFacade) result).setSuperClass(persistentClass);
    return result;
}
Also used : AbstractPersistentClassFacade(org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) SingleTableSubclass(org.hibernate.mapping.SingleTableSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 3 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);
    Assert.assertNotNull(singleTableSublass);
    Object target = ((IFacade) singleTableSublass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof SingleTableSubclass);
    Assert.assertSame(persistentClass, singleTableSublass.getSuperclass());
    Assert.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.Test)

Example 4 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);
    Assert.assertNotNull(singleTableSublass);
    Object target = ((IFacade) singleTableSublass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof SingleTableSubclass);
    Assert.assertSame(persistentClass, singleTableSublass.getSuperclass());
    Assert.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.Test)

Example 5 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);
    Assert.assertNotNull(singleTableSublass);
    Object target = ((IFacade) singleTableSublass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof SingleTableSubclass);
    Assert.assertSame(persistentClass, singleTableSublass.getSuperclass());
    Assert.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.Test)

Aggregations

SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)10 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)8 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)8 Test (org.junit.Test)5 PersistentClass (org.hibernate.mapping.PersistentClass)4 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)4 IdentifiableTypeSource (org.hibernate.boot.model.source.spi.IdentifiableTypeSource)1 JoinedSubclass (org.hibernate.mapping.JoinedSubclass)1 RootClass (org.hibernate.mapping.RootClass)1 Subclass (org.hibernate.mapping.Subclass)1 UnionSubclass (org.hibernate.mapping.UnionSubclass)1