Search in sources :

Example 1 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method newReverseEngineeringStrategy.

@Override
public IReverseEngineeringStrategy newReverseEngineeringStrategy(String strategyName, IReverseEngineeringStrategy delegate) {
    assert delegate instanceof IFacade;
    ReverseEngineeringStrategy delegateTarget = (ReverseEngineeringStrategy) ((IFacade) delegate).getTarget();
    Object target = newReverseEngineeringStrategy(strategyName, delegateTarget);
    return facadeFactory.createReverseEngineeringStrategy(target);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade)

Example 2 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method newReverseEngineeringStrategy.

@Override
public IReverseEngineeringStrategy newReverseEngineeringStrategy(String strategyName, IReverseEngineeringStrategy delegate) {
    assert delegate instanceof IFacade;
    ReverseEngineeringStrategy delegateTarget = (ReverseEngineeringStrategy) ((IFacade) delegate).getTarget();
    Object target = newReverseEngineeringStrategy(strategyName, delegateTarget);
    return facadeFactory.createReverseEngineeringStrategy(target);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade)

Example 3 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method newReverseEngineeringStrategy.

@Override
public IReverseEngineeringStrategy newReverseEngineeringStrategy(String strategyName, IReverseEngineeringStrategy delegate) {
    assert delegate instanceof IFacade;
    ReverseEngineeringStrategy delegateTarget = (ReverseEngineeringStrategy) ((IFacade) delegate).getTarget();
    Object target = newReverseEngineeringStrategy(strategyName, delegateTarget);
    return facadeFactory.createReverseEngineeringStrategy(target);
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade)

Example 4 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method newReverseEngineeringStrategy.

@SuppressWarnings("unchecked")
private ReverseEngineeringStrategy newReverseEngineeringStrategy(final String className, ReverseEngineeringStrategy delegate) {
    try {
        Class<ReverseEngineeringStrategy> clazz = (Class<ReverseEngineeringStrategy>) ReflectHelper.classForName(className);
        Constructor<ReverseEngineeringStrategy> constructor = clazz.getConstructor(new Class[] { ReverseEngineeringStrategy.class });
        return constructor.newInstance(new Object[] { delegate });
    } catch (NoSuchMethodException e) {
        try {
            Class<?> clazz = ReflectHelper.classForName(className);
            ReverseEngineeringStrategy rev = (ReverseEngineeringStrategy) clazz.newInstance();
            return rev;
        } catch (Exception eq) {
            throw new HibernateConsoleRuntimeException(eq);
        }
    } catch (Exception e) {
        throw new HibernateConsoleRuntimeException(e);
    }
}
Also used : IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) HibernateConsoleRuntimeException(org.hibernate.console.HibernateConsoleRuntimeException) InvocationTargetException(java.lang.reflect.InvocationTargetException) SQLException(java.sql.SQLException) HibernateConsoleRuntimeException(org.hibernate.console.HibernateConsoleRuntimeException)

Example 5 with ReverseEngineeringStrategy

use of org.hibernate.cfg.reveng.ReverseEngineeringStrategy in project jbosstools-hibernate by jbosstools.

the class ServiceImpl method newReverseEngineeringStrategy.

@SuppressWarnings("unchecked")
private ReverseEngineeringStrategy newReverseEngineeringStrategy(final String className, ReverseEngineeringStrategy delegate) {
    try {
        Class<ReverseEngineeringStrategy> clazz = (Class<ReverseEngineeringStrategy>) ReflectHelper.classForName(className);
        Constructor<ReverseEngineeringStrategy> constructor = clazz.getConstructor(new Class[] { ReverseEngineeringStrategy.class });
        return constructor.newInstance(new Object[] { delegate });
    } catch (NoSuchMethodException e) {
        try {
            Class<?> clazz = ReflectHelper.classForName(className);
            ReverseEngineeringStrategy rev = (ReverseEngineeringStrategy) clazz.newInstance();
            return rev;
        } catch (Exception eq) {
            throw new HibernateException(eq);
        }
    } catch (Exception e) {
        throw new HibernateException(e);
    }
}
Also used : HibernateException(org.jboss.tools.hibernate.runtime.spi.HibernateException) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) DefaultReverseEngineeringStrategy(org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy) ReverseEngineeringStrategy(org.hibernate.cfg.reveng.ReverseEngineeringStrategy) PersistentClass(org.hibernate.mapping.PersistentClass) RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) HibernateException(org.jboss.tools.hibernate.runtime.spi.HibernateException)

Aggregations

DefaultReverseEngineeringStrategy (org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy)36 ReverseEngineeringStrategy (org.hibernate.cfg.reveng.ReverseEngineeringStrategy)36 IReverseEngineeringStrategy (org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy)36 Test (org.junit.Test)28 DelegatingReverseEngineeringStrategy (org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy)12 PersistentClass (org.hibernate.mapping.PersistentClass)12 RootClass (org.hibernate.mapping.RootClass)12 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)12 Field (java.lang.reflect.Field)8 POJOClass (org.hibernate.tool.hbm2x.pojo.POJOClass)8 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)8 IPOJOClass (org.jboss.tools.hibernate.runtime.spi.IPOJOClass)8 JDBCMetaDataConfiguration (org.hibernate.cfg.JDBCMetaDataConfiguration)7 HibernateConsoleRuntimeException (org.hibernate.console.HibernateConsoleRuntimeException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 SQLException (java.sql.SQLException)1 HibernateException (org.jboss.tools.hibernate.runtime.spi.HibernateException)1 JdbcMetadataConfiguration (org.jboss.tools.hibernate.runtime.v_5_3.internal.util.JdbcMetadataConfiguration)1