Search in sources :

Example 1 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass 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 2 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass 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 IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass 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 4 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass 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 5 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ElementsFactory method createShape.

protected OrmShape createShape(Object ormElement) {
    OrmShape ormShape = null;
    if (ormElement instanceof IProperty) {
        IPersistentClass specialRootClass = getService().newSpecialRootClass((IProperty) ormElement);
        String key = Utils.getName(specialRootClass.getEntityName());
        ormShape = elements.get(key);
        if (null == ormShape) {
            ormShape = new SpecialOrmShape(specialRootClass, consoleConfigName);
            elements.put(key, ormShape);
        }
    } else {
        String key = Utils.getName(ormElement);
        ormShape = elements.get(key);
        if (null == ormShape) {
            ormShape = new OrmShape(ormElement, consoleConfigName);
            elements.put(key, ormShape);
        }
    }
    return ormShape;
}
Also used : IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass)

Aggregations

IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)175 Test (org.junit.Test)97 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)60 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)51 RootClass (org.hibernate.mapping.RootClass)47 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)46 PersistentClass (org.hibernate.mapping.PersistentClass)43 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)19 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)16 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)16 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)14 OneToMany (org.hibernate.mapping.OneToMany)12 HashMap (java.util.HashMap)8 Iterator (java.util.Iterator)8 JoinedSubclass (org.hibernate.mapping.JoinedSubclass)8 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)8 Property (org.hibernate.mapping.Property)8 SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)8 IEditorPart (org.eclipse.ui.IEditorPart)7 PartInitException (org.eclipse.ui.PartInitException)7