Search in sources :

Example 11 with JoinedSubclass

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

the class PersistentClassFacadeTest method testIsJoinedSubclass.

@Test
public void testIsJoinedSubclass() {
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, new RootClass(null));
    assertFalse(persistentClassFacade.isJoinedSubclass());
    Table rootTable = new Table();
    Table subTable = new Table();
    RootClass rootClass = new RootClass(null);
    rootClass.setTable(rootTable);
    JoinedSubclass subclass = new JoinedSubclass(rootClass, null);
    subclass.setTable(subTable);
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, subclass);
    assertTrue(persistentClassFacade.isJoinedSubclass());
    subclass.setTable(rootTable);
    assertFalse(persistentClassFacade.isJoinedSubclass());
}
Also used : RootClass(org.hibernate.mapping.RootClass) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) Test(org.junit.jupiter.api.Test)

Example 12 with JoinedSubclass

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

the class ServiceImpl method newJoinedSubclass.

@Override
public IPersistentClass newJoinedSubclass(IPersistentClass persistentClass) {
    assert persistentClass instanceof IFacade;
    IPersistentClass result = facadeFactory.createPersistentClass(new JoinedSubclass((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) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 13 with JoinedSubclass

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

the class PersistentClassFacadeTest method testIsInstanceOfJoinedSubclass.

@Test
public void testIsInstanceOfJoinedSubclass() {
    assertFalse(persistentClassFacade.isInstanceOfJoinedSubclass());
    JoinedSubclass joinedSubclassTarget = new JoinedSubclass(persistentClassTarget);
    IPersistentClass joinedSubclassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, joinedSubclassTarget);
    assertTrue(joinedSubclassFacade.isInstanceOfJoinedSubclass());
}
Also used : JoinedSubclass(org.hibernate.mapping.JoinedSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 14 with JoinedSubclass

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

the class PersistentClassFacadeTest method testIsInstanceOfJoinedSubclass.

@Test
public void testIsInstanceOfJoinedSubclass() {
    assertFalse(persistentClassFacade.isInstanceOfJoinedSubclass());
    JoinedSubclass joinedSubclassTarget = new JoinedSubclass(persistentClassTarget, null);
    IPersistentClass joinedSubclassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, joinedSubclassTarget);
    assertTrue(joinedSubclassFacade.isInstanceOfJoinedSubclass());
}
Also used : JoinedSubclass(org.hibernate.mapping.JoinedSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 15 with JoinedSubclass

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

the class PersistentClassFacadeTest method testIsJoinedSubclass.

@Test
public void testIsJoinedSubclass() {
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, new RootClass(null));
    assertFalse(persistentClassFacade.isJoinedSubclass());
    Table rootTable = new Table();
    Table subTable = new Table();
    RootClass rootClass = new RootClass(null);
    rootClass.setTable(rootTable);
    JoinedSubclass subclass = new JoinedSubclass(rootClass, null);
    subclass.setTable(subTable);
    persistentClassFacade = new PersistentClassFacadeImpl(FACADE_FACTORY, subclass);
    assertTrue(persistentClassFacade.isJoinedSubclass());
    subclass.setTable(rootTable);
    assertFalse(persistentClassFacade.isJoinedSubclass());
}
Also used : RootClass(org.hibernate.mapping.RootClass) ITable(org.jboss.tools.hibernate.runtime.spi.ITable) Table(org.hibernate.mapping.Table) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) Test(org.junit.jupiter.api.Test)

Aggregations

JoinedSubclass (org.hibernate.mapping.JoinedSubclass)49 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)33 Test (org.junit.jupiter.api.Test)33 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)22 RootClass (org.hibernate.mapping.RootClass)14 PersistentClass (org.hibernate.mapping.PersistentClass)13 Table (org.hibernate.mapping.Table)12 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)11 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)11 Iterator (java.util.Iterator)2 AnnotationException (org.hibernate.AnnotationException)2 DependantValue (org.hibernate.mapping.DependantValue)2 SimpleValue (org.hibernate.mapping.SimpleValue)2 Subclass (org.hibernate.mapping.Subclass)2 UnionSubclass (org.hibernate.mapping.UnionSubclass)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 CollectionTable (javax.persistence.CollectionTable)1 Entity (javax.persistence.Entity)1 JoinTable (javax.persistence.JoinTable)1