mister_m 12 de abr. de 2005
Esta é a única mensagem que você recebe em todo o stack trace? Isso ocorre quando o nome da classe do generator está vazia ou é inválido. Algum dos seus mapeamentos está incorreto.
ivanmc 12 de abr. de 2005
Acho que o problema é que tenho 2 tabelas com chave String, e por isso não coloquei generator. Exemplo :
/**
* @hibernate.id
* name="sigla"
* type="string"
* column="sexo_sg"
*/
public String getSigla () {
return sigla ;
}
Ai vai o trace
( cfg . Environment 478 ) Hibernate 2.1.7
( cfg . Environment 512 ) loaded properties from resource hibernate . properties : { hibernate . connection . driver_class = oracle . jdbc . driver . OracleDriver , hibernate . cglib . use_reflection_optimizer = true , hibernate . cache . provider_class = net . sf . hibernate . cache . EhCacheProvider , hibernate . cache . use_query_cache = true , hibernate . max_fetch_depth = 1 , hibernate . dialect = net . sf . hibernate . dialect . Oracle9Dialect , hibernate . jdbc . use_streams_for_binary = true , hibernate . jdbc . batch_size = 0 , hibernate . query . substitutions = true 1 , false 0 , yes ‘ Y ’ , no ‘ N ’ , hibernate . proxool . pool_alias = pool1 , hibernate . connection . username = jFaturamento , hibernate . cache . region_prefix = hibernate . test , hibernate . connection . url = jdbc : oracle : thin : @192.107.179.221 : 1521 : PRD , hibernate . show_sql = true , hibernate . connection . password = jFat , hibernate . jdbc . batch_versioned_data = true , hibernate . connection . pool_size = 1 }
( cfg . Environment 537 ) using < a href = "http://java.io" > java . io </ a > streams to persist binary types
( cfg . Environment 538 ) using CGLIB reflection optimizer
( cfg . Environment 567 ) using JDK 1.4 java . sql . Timestamp handling
( cfg . Configuration 900 ) configuring from resource : / hibernate . cfg . xml
( cfg . Configuration 872 ) Configuration resource : / hibernate . cfg . xml
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / Paciente . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . Paciente -> AGENDA . PICR_PACIENTE
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / Sexo . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . Sexo -> AGENDA . PICR_SEXO
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / EstadoCivil . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . EstadoCivil -> AGENDA . PICR_ESTADO_CIVIL
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / OcupacaoProfissional . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . OcupacaoProfissional -> AGENDA . PICR_OCUPACAO
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / Cor . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . Cor -> AGENDA . PICR_COR
( cfg . Configuration 331 ) Mapping resource : br / usp / hcnet / icr / his / modelo / GrauDeInstrucao . hbm . xml
( cfg . Binder 230 ) Mapping class : br . usp . hcnet . icr . his . modelo . GrauDeInstrucao -> AGENDA . PICR_GRAU_INSTRUCAO
( cfg . Configuration 1058 ) Configured SessionFactory : SessionFactoryDB
( cfg . Configuration 632 ) processing one - to - many association mappings
( cfg . Binder 1182 ) Mapping collection : br . usp . hcnet . icr . his . modelo . Sexo . pacientes -> AGENDA . PICR_SEXO
( cfg . Binder 1182 ) Mapping collection : br . usp . hcnet . icr . his . modelo . EstadoCivil . pacientes -> AGENDA . PICR_ESTADO_CIVIL
( cfg . Binder 1182 ) Mapping collection : br . usp . hcnet . icr . his . modelo . OcupacaoProfissional . pacientes -> AGENDA . PICR_OCUPACAO
( cfg . Binder 1182 ) Mapping collection : br . usp . hcnet . icr . his . modelo . Cor . pacientes -> AGENDA . PICR_COR
( cfg . Binder 1182 ) Mapping collection : br . usp . hcnet . icr . his . modelo . GrauDeInstrucao . pacientes -> AGENDA . PICR_GRAU_INSTRUCAO
( cfg . Configuration 641 ) processing one - to - one association property references
( cfg . Configuration 666 ) processing foreign key constraints
( dialect . Dialect 86 ) Using dialect : net . sf . hibernate . dialect . Oracle9Dialect
( cfg . SettingsFactory 70 ) Maximim outer join fetch depth : 1
( cfg . SettingsFactory 74 ) Use outer join fetching : true
( connection . DriverManagerConnectionProvider 42 ) Using Hibernate built - in connection pool ( not for production use ! )
( connection . DriverManagerConnectionProvider 43 ) Hibernate connection pool size : 1
( connection . DriverManagerConnectionProvider 77 ) using driver : oracle . jdbc . driver . OracleDriver at URL : jdbc : oracle : thin : @192.107.179.221 : 1521 : PRD
( connection . DriverManagerConnectionProvider 78 ) connection properties : { user = agenda , password = astro }
( transaction . TransactionFactoryFactory 31 ) Transaction strategy : net . sf . hibernate . transaction . JDBCTransactionFactory
( transaction . TransactionManagerLookupFactory 33 ) No TransactionManagerLookup configured ( in JTA environment , use of process level read - write cache is not recommended )
( cfg . SettingsFactory 114 ) Use scrollable result sets : true
( cfg . SettingsFactory 117 ) Use JDBC3 getGeneratedKeys () : false
( cfg . SettingsFactory 120 ) Optimize cache for minimal puts : false
( cfg . SettingsFactory 129 ) Query language substitutions : { no = ‘ N ’ , true = 1 , yes = ‘ Y ’ , false = 0 }
( cfg . SettingsFactory 140 ) cache provider : net . sf . hibernate . cache . EhCacheProvider
( cfg . SettingsFactory 152 ) query cache factory : net . sf . hibernate . cache . StandardQueryCacheFactory
( cfg . Configuration 1121 ) instantiating and configuring caches
( impl . SessionFactoryImpl 119 ) building session factory
net . sf . hibernate . MappingException : could not instantiate id generator
at net . sf . hibernate . id . IdentifierGeneratorFactory . create ( IdentifierGeneratorFactory . java : 82 )
at net . sf . hibernate . mapping . SimpleValue . createIdentifierGenerator ( SimpleValue . java : 82 )
at net . sf . hibernate . persister . AbstractEntityPersister .( AbstractEntityPersister . java : 645 )
at net . sf . hibernate . persister . EntityPersister .( EntityPersister . java : 692 )
at net . sf . hibernate . persister . PersisterFactory . createClassPersister ( PersisterFactory . java : 42 )
at net . sf . hibernate . impl . SessionFactoryImpl .( SessionFactoryImpl . java : 137 )
at net . sf . hibernate . cfg . Configuration . buildSessionFactory ( Configuration . java : 796 )
at br . usp . hcnet . icr . his . dao . Conexao . abre ( Conexao . java : 24 )
at br . usp . hcnet . icr . his . modelo . Paciente . getInstancia ( Paciente . java : 279 )
at br . usp . hcnet . icr . his . teste . testeTelaGrafica . main ( testeTelaGrafica . java : 25 )
Caused by : java . lang . ClassNotFoundException :
at java . lang . Class . forName0 ( Native Method )
at java . lang . Class . forName ( Unknown Source )
at net . sf . hibernate . util . ReflectHelper . classForName ( ReflectHelper . java : 102 )
at net . sf . hibernate . id . IdentifierGeneratorFactory . create ( IdentifierGeneratorFactory . java : 76 )
… 9 more
Exception in thread “ main ” java . lang . NullPointerException
at br . usp . hcnet . icr . his . modelo . Paciente . getInstancia ( Paciente . java : 282 )
at br . usp . hcnet . icr . his . teste . testeTelaGrafica . main ( testeTelaGrafica . java : 25 )
mister_m 12 de abr. de 2005
Você precisa definir o generator-class como assigned nesses casos.
ivanmc 12 de abr. de 2005
Vou tentar, valeu pela dica!
Essa comunidade é 10 !!!
ivanmc 12 de abr. de 2005
Valeu Michael, funcionou em cima !