Search in sources :

Example 31 with JoinedSubclass

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

the class ServiceImplTest method testNewJoinedSubclass.

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

Example 32 with JoinedSubclass

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

the class ServiceImplTest method testNewJoinedSubclass.

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

Example 33 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 34 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());
    assertFalse(persistentClassFacade.isJoinedSubclass());
    Table rootTable = new Table();
    Table subTable = new Table();
    RootClass rootClass = new RootClass();
    rootClass.setTable(rootTable);
    JoinedSubclass subclass = new JoinedSubclass(rootClass);
    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 35 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