Search in sources :

Example 46 with PersistentClass

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

the class ConfigurationFacadeImpl method initializeClassMappings.

@Override
protected void initializeClassMappings() {
    HashMap<String, IPersistentClass> classMappings = new HashMap<String, IPersistentClass>();
    Iterator<PersistentClass> origin = getMetadata().getEntityBindings().iterator();
    while (origin.hasNext()) {
        IPersistentClass pc = getFacadeFactory().createPersistentClass(origin.next());
        classMappings.put(pc.getEntityName(), pc);
    }
    for (IPersistentClass pc : addedClasses) {
        classMappings.put(pc.getEntityName(), pc);
    }
    setClassMappings(classMappings);
}
Also used : HashMap(java.util.HashMap) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Example 47 with PersistentClass

use of org.hibernate.mapping.PersistentClass 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 48 with PersistentClass

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

the class FacadeFactoryTest method testCreatePersistentClass.

@Test
public void testCreatePersistentClass() {
    PersistentClass persistentClass = new RootClass();
    IPersistentClass facade = facadeFactory.createPersistentClass(persistentClass);
    Assert.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.Test)

Example 49 with PersistentClass

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

the class Cfg2HbmToolFacadeTest method testGetPersistentClassTag.

@Test
public void testGetPersistentClassTag() {
    PersistentClass target = new RootClass();
    IPersistentClass persistentClass = new AbstractPersistentClassFacade(FACADE_FACTORY, target) {
    };
    Assert.assertEquals("class", cfg2HbmToolFacade.getTag(persistentClass));
}
Also used : RootClass(org.hibernate.mapping.RootClass) AbstractPersistentClassFacade(org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) Test(org.junit.Test)

Example 50 with PersistentClass

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

the class ConfigurationFacadeTest method testAddClass.

@Test
public void testAddClass() {
    PersistentClass persistentClass = new RootClass();
    persistentClass.setEntityName("Foo");
    IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
    Assert.assertNull(configuration.getClassMapping("Foo"));
    configurationFacade.addClass(persistentClassFacade);
    Assert.assertEquals(persistentClass, configuration.getClassMapping("Foo"));
}
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.Test)

Aggregations

PersistentClass (org.hibernate.mapping.PersistentClass)229 Test (org.junit.Test)121 Property (org.hibernate.mapping.Property)65 MetadataSources (org.hibernate.boot.MetadataSources)53 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)52 RootClass (org.hibernate.mapping.RootClass)50 Metadata (org.hibernate.boot.Metadata)45 Column (org.hibernate.mapping.Column)43 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)42 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)38 Iterator (java.util.Iterator)30 SimpleValue (org.hibernate.mapping.SimpleValue)24 HashMap (java.util.HashMap)22 Collection (org.hibernate.mapping.Collection)21 MappingException (org.hibernate.MappingException)20 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)20 Table (org.hibernate.mapping.Table)20 Map (java.util.Map)19 ArrayList (java.util.ArrayList)18 TestForIssue (org.hibernate.testing.TestForIssue)18