Caros Colegas,
Alguém poderia me dizer como faço para usar o hibernate.cfg.xml?
O meu objetivo é mapear corretamente os hbm’s, pois estou recebendo o erro "net.sf.hibernate.MappingException: An association from the table usuario refers to an unmapped class: net.sinapse.patrimonio.bean.GrupoUsuario "
por isso estou achando que o problema é o mapeamente das classes no hibernate.cfg.xml
Segue abaixo:
2004-12-29 19:49:05,328 INFO hibernate.cfg.Environment -> Hibernate 2.1.7
2004-12-29 19:49:05,468 INFO hibernate.cfg.Environment -> loaded properties from resource hibernate.properties: {hibernate.connection.username=teste, hibernate.connection.password=teste, hibernate.cglib.use_reflection_optimizer=true, hibernate.connection.pool_size=3, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://201.11.84.56:5432/ativo, hibernate.connection.driver_class=org.postgresql.Driver}
2004-12-29 19:49:05,515 INFO hibernate.cfg.Environment -> using CGLIB reflection optimizer
2004-12-29 19:49:05,625 INFO hibernate.cfg.Environment -> using JDK 1.4 java.sql.Timestamp handling
2004-12-29 19:49:05,625 INFO hibernate.cfg.Configuration -> Mapping resource: net/sinapse/patrimonio/bean/Usuario.hbm.xml
2004-12-29 19:49:07,437 DEBUG hibernate.util.DTDEntityResolver -> trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/
2004-12-29 19:49:07,437 DEBUG hibernate.util.DTDEntityResolver -> found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath
2004-12-29 19:49:08,125 INFO hibernate.cfg.Binder -> Mapping class: net.sinapse.patrimonio.bean.Usuario -> usuario
2004-12-29 19:49:08,437 DEBUG hibernate.cfg.Binder -> Mapped property: codigo -> codigo, type: integer
2004-12-29 19:49:08,468 DEBUG hibernate.cfg.Binder -> Mapped property: nome -> nome, type: string
2004-12-29 19:49:08,468 DEBUG hibernate.cfg.Binder -> Mapped property: login -> login, type: string
2004-12-29 19:49:08,484 DEBUG hibernate.cfg.Binder -> Mapped property: senha -> senha, type: string
2004-12-29 19:49:08,515 DEBUG hibernate.cfg.Binder -> Mapped property: grupoUsuario -> codigo_grupo, type: net.sinapse.patrimonio.bean.GrupoUsuario
2004-12-29 19:49:08,515 INFO hibernate.cfg.Configuration -> processing one-to-many association mappings
2004-12-29 19:49:08,515 INFO hibernate.cfg.Configuration -> processing one-to-one association property references
2004-12-29 19:49:08,515 INFO hibernate.cfg.Configuration -> processing foreign key constraints
2004-12-29 19:49:08,515 DEBUG hibernate.cfg.Configuration -> resolving reference to class: net.sinapse.patrimonio.bean.GrupoUsuario
net.sf.hibernate.MappingException: An association from the table usuario refers to an unmapped class: net.sinapse.patrimonio.bean.GrupoUsuario
at net.sf.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:687)
at net.sf.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:671)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
at net.sinapse.patrimonio.dao.UsuarioDao.getSessionCadastro(UsuarioDao.java:45)
at net.sinapse.patrimonio.dao.UsuarioDao.insert(UsuarioDao.java:60)
at net.sinapse.patrimonio.main.SNHibernateTeste.incluirUsuario(SNHibernateTeste.java:69)
at net.sinapse.patrimonio.main.SNHibernateTeste.<init>(SNHibernateTeste.java:30)
at net.sinapse.patrimonio.main.SNHibernateTeste.main(SNHibernateTeste.java:24)
java.lang.NullPointerException
at net.sinapse.patrimonio.dao.UsuarioDao.insert(UsuarioDao.java:62)
at net.sinapse.patrimonio.main.SNHibernateTeste.incluirUsuario(SNHibernateTeste.java:69)
at net.sinapse.patrimonio.main.SNHibernateTeste.<init>(SNHibernateTeste.java:30)
at net.sinapse.patrimonio.main.SNHibernateTeste.main(SNHibernateTeste.java:24)