Search in sources :

Example 51 with RootClass

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

the class FacadeFactoryTest method testCreatePersistentClass.

@Test
public void testCreatePersistentClass() {
    PersistentClass persistentClass = new RootClass(null);
    IPersistentClass facade = facadeFactory.createPersistentClass(persistentClass);
    assertTrue(facade instanceof PersistentClassFacadeImpl);
    assertSame(persistentClass, ((IFacade) facade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test)

Example 52 with RootClass

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

the class HibernateMappingExporterExtensionTest method createPojoClass.

private POJOClass createPojoClass() {
    RootClass persistentClass = new RootClass(null);
    Table rootTable = new Table();
    rootTable.setName("table");
    persistentClass.setTable(rootTable);
    persistentClass.setEntityName("Bar");
    persistentClass.setClassName("foo.Bar");
    return new EntityPOJOClass(persistentClass, new Cfg2JavaTool());
}
Also used : RootClass(org.hibernate.mapping.RootClass) EntityPOJOClass(org.hibernate.tool.hbm2x.pojo.EntityPOJOClass) Table(org.hibernate.mapping.Table) Cfg2JavaTool(org.hibernate.tool.hbm2x.Cfg2JavaTool)

Example 53 with RootClass

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

the class SpecialRootClassFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    PersistentClass persistentClassTarget = new RootClass();
    Property propertyTarget = new Property();
    propertyTarget.setPersistentClass(persistentClassTarget);
    specialRootClassFacade = new SpecialRootClassFacadeImpl(FACADE_FACTORY, FACADE_FACTORY.createProperty(propertyTarget));
}
Also used : RootClass(org.hibernate.mapping.RootClass) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) PersistentClass(org.hibernate.mapping.PersistentClass) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 54 with RootClass

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

the class TypeFacadeTest method testIsComponentType.

@Test
public void testIsComponentType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    assertFalse(typeFacade.isComponentType());
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, TestDialect.class.getName());
    StandardServiceRegistry ssr = ssrb.build();
    MetadataBuildingOptions mdbo = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(ssr);
    MetadataImplementor mdi = (MetadataImplementor) new MetadataBuilderImpl(new MetadataSources(ssr)).build();
    ComponentType componentType = new ComponentType(null, new ComponentMetamodel(new Component(mdi, new RootClass(null)), mdbo));
    typeFacade = FACADE_FACTORY.createType(componentType);
    assertTrue(typeFacade.isComponentType());
}
Also used : RootClass(org.hibernate.mapping.RootClass) ComponentType(org.hibernate.type.ComponentType) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) ComponentMetamodel(org.hibernate.tuple.component.ComponentMetamodel) MetadataSources(org.hibernate.boot.MetadataSources) MetadataImplementor(org.hibernate.boot.spi.MetadataImplementor) ClassType(org.hibernate.type.ClassType) MetadataBuilderImpl(org.hibernate.boot.internal.MetadataBuilderImpl) IType(org.jboss.tools.hibernate.runtime.spi.IType) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions) Component(org.hibernate.mapping.Component) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.jupiter.api.Test)

Example 55 with RootClass

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

the class ValueFacadeTest method testGetAssociatedClass.

@Test
public void testGetAssociatedClass() {
    RootClass rootClass = new RootClass(null);
    OneToMany oneToManyTarget = new OneToMany(null, null);
    valueFacade = FACADE_FACTORY.createValue(oneToManyTarget);
    assertNull(valueFacade.getAssociatedClass());
    oneToManyTarget.setAssociatedClass(rootClass);
    assertSame(rootClass, ((IFacade) valueFacade.getAssociatedClass()).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) OneToMany(org.hibernate.mapping.OneToMany) Test(org.junit.jupiter.api.Test)

Aggregations

RootClass (org.hibernate.mapping.RootClass)609 Test (org.junit.jupiter.api.Test)471 PersistentClass (org.hibernate.mapping.PersistentClass)166 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)162 Field (java.lang.reflect.Field)149 SimpleValue (org.hibernate.mapping.SimpleValue)142 Table (org.hibernate.mapping.Table)136 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)130 Property (org.hibernate.mapping.Property)124 Component (org.hibernate.mapping.Component)109 Column (org.hibernate.mapping.Column)53 ArrayList (java.util.ArrayList)51 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)51 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)44 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)43 Configuration (org.hibernate.cfg.Configuration)37 OneToOne (org.hibernate.mapping.OneToOne)37 MetadataSources (org.hibernate.boot.MetadataSources)35 Test (org.junit.Test)35 SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)34