Hibernate version: 3.2.5.ga
Full stack trace of any exception that occurs:
org.hibernate.console.HibernateConsoleRuntimeException: Could not configure naming strategy br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
Could not configure naming strategy br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
java.lang.InstantiationException: br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
java.lang.InstantiationException: br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
br.eti.avila.rxc.util.EstrategiaDeEngenhariaReversa
Name and version of the database you are using: PostgreSQL 8.2
Hi all,
I make an brand new install of Eclipse WebTools 2.0.1 (use Eclipse 3.3.1 as base) + Hibernate Tools 3.2.0.ga. When I try to generate classes using reverse engineering, i receive the error mentioned in
Full stack trace of any exception that occurs: section of this post. What I'm doing wrong?
My RevEng class:
Code:
package br.eti.avila.rxc.util;
import java.sql.Types;
import org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
import org.hibernate.cfg.reveng.TableIdentifier;
/**
* Define estratégia para geração de classes do Hibernate
*
* @author <a href="mailto:rodrigo@avila.eti.br">Rodrigo de Avila</a>
* @version $Revision: 1.3 $
*
*/
public class EstrategiaDeEngenhariaReversa extends DelegatingReverseEngineeringStrategy {
public EstrategiaDeEngenhariaReversa(ReverseEngineeringStrategy delegate) {
super(delegate);
}
/**
* Define que todos os IDs de tabelas usarão gerador de inteiro nativo.
*/
public String getTableIdentifierStrategyName(org.hibernate.cfg.reveng.TableIdentifier t) {
// Não usa estratégia Native para algumas tabelas
// (normalmente tabelas que tem chaves naturais, importadas através do
// módulo de Importação.
if( t.getName().equalsIgnoreCase( "uf" ) ||
t.getName().equalsIgnoreCase( "municipio" ) ||
t.getName().equalsIgnoreCase( "tabelasDeProcedimentos" ) ) {
return super.getTableIdentifierStrategyName(t);
} else {
return "native";
}
}
/**
* Define que todos os tipos TIMESTAMP serão definidos por um PersistentDateTime
*/
public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
if(sqlType==Types.TIMESTAMP) {
return "br.eti.avila.rxc.util.PersistentDateTime";
} else {
return super.columnToHibernateTypeName(table, columnName, sqlType, length, precision, scale, nullable, generatedIdentifier );
}
}
}
Note: if I use WebTools 1.5.5 + Hibernate Tools 3.2.0.beta9a, this class works perfectly.