use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newReverseEngineeringStrategy.
private Object newReverseEngineeringStrategy(final String className, Object delegate) {
try {
Class<?> clazz = ReflectHelper.classForName(className);
Class<?> revEngClass = ReflectHelper.classForName("org.hibernate.cfg.reveng.ReverseEngineeringStrategy");
Constructor<?> constructor = clazz.getConstructor(new Class[] { revEngClass });
return constructor.newInstance(new Object[] { delegate });
} catch (NoSuchMethodException e) {
try {
Class<?> clazz = ReflectHelper.classForName(className);
return clazz.newInstance();
} catch (Exception eq) {
throw new HibernateConsoleRuntimeException(eq);
}
} catch (Exception e) {
throw new HibernateConsoleRuntimeException(e);
}
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newDialect.
@Override
public String newDialect(Properties properties, final Connection connection) {
ServiceRegistry serviceRegistry = buildServiceRegistry(properties);
DialectFactory dialectFactory = serviceRegistry.getService(DialectFactory.class);
Dialect dialect = dialectFactory.buildDialect(properties, new DialectResolutionInfoSource() {
@Override
public DialectResolutionInfo getDialectResolutionInfo() {
try {
return new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData());
} catch (SQLException sqlException) {
throw new HibernateConsoleRuntimeException("Unable to access java.sql.DatabaseMetaData to determine appropriate Dialect to use", sqlException);
}
}
});
return dialect != null ? dialect.toString() : null;
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newDialect.
@Override
public String newDialect(Properties properties, final Connection connection) {
ServiceRegistry serviceRegistry = buildServiceRegistry(properties);
DialectFactory dialectFactory = serviceRegistry.getService(DialectFactory.class);
Dialect dialect = dialectFactory.buildDialect(properties, new DialectResolutionInfoSource() {
@Override
public DialectResolutionInfo getDialectResolutionInfo() {
try {
return new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData());
} catch (SQLException sqlException) {
throw new HibernateConsoleRuntimeException("Unable to access java.sql.DatabaseMetaData to determine appropriate Dialect to use", sqlException);
}
}
});
return dialect != null ? dialect.toString() : null;
}
use of org.hibernate.console.HibernateConsoleRuntimeException 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);
}
}
use of org.hibernate.console.HibernateConsoleRuntimeException in project jbosstools-hibernate by jbosstools.
the class ServiceImpl method newDialect.
@Override
public String newDialect(Properties properties, final Connection connection) {
ServiceRegistry serviceRegistry = buildServiceRegistry(properties);
DialectFactory dialectFactory = serviceRegistry.getService(DialectFactory.class);
Dialect dialect = dialectFactory.buildDialect(properties, new DialectResolutionInfoSource() {
@Override
public DialectResolutionInfo getDialectResolutionInfo() {
try {
return new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData());
} catch (SQLException sqlException) {
throw new HibernateConsoleRuntimeException("Unable to access java.sql.DatabaseMetaData to determine appropriate Dialect to use", sqlException);
}
}
});
return dialect != null ? dialect.toString() : null;
}
Aggregations