Erro na inserção usando Hibernate

quando eu rodo a classe TestaUsuario da o seguinte erro…

16:44:45,917 INFO Environment:514 - Hibernate 3.2.4.sp1
16:44:45,932 INFO Environment:532 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.hsqldb.jdbcDriver, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.HSQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.substitutions=yes ‘Y’, no ‘N’, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:hsqldb:./build/db/hsqldb/hibernate, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
16:44:45,932 INFO Environment:563 - using java.io streams to persist binary types
16:44:45,932 INFO Environment:681 - Bytecode provider name : cglib
16:44:45,948 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
16:44:46,057 INFO Configuration:1426 - configuring from resource: /hibernate.cfg.xml
16:44:46,057 INFO Configuration:1403 - Configuration resource: /hibernate.cfg.xml
16:44:46,448 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
16:44:46,479 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
16:44:46,479 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
16:44:46,573 DEBUG Configuration:1387 - hibernate.connection.driver_class=com.mysql.jdbc.Driver
16:44:46,573 DEBUG Configuration:1387 - hibernate.connection.url=jdbc:mysql://localhost/teste
16:44:46,573 DEBUG Configuration:1387 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
16:44:46,573 DEBUG Configuration:1387 - hibernate.connection.username=root
16:44:46,573 DEBUG Configuration:1387 - hibernate.connection.password=root
16:44:46,573 DEBUG Configuration:1387 - hibernate.show_sql=true
16:44:46,573 DEBUG Configuration:1387 - hibernate.format_sql=true
Exception in thread “main” org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class=“br.com.caelum.lojavirtual.modelo.Usuario”/>
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1600)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at br.com.caelum.lojavirtual.main.TestaUsuario.main(TestaUsuario.java:14)

estou seguindo pela apostila nova da caelum…

alguem consegui me explicar esse erro…
já fiz tudo passo a passo como diz a apostila já criou a tabela só na hora de inserir que deu esse erro…

Acho que o erro ta bem explicadinho ai…

Nao vou te dizer exatamente o que é, pra que vc nao se torne mais um, como diz o cv, “anemico stacktraceal”.

[quote=fabiocsi][quote=jc.thalys]
Exception in thread “main” org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class=“br.com.caelum.lojavirtual.modelo.Usuario”/>
[/quote]

Acho que o erro ta bem explicadinho ai…

Nao vou te dizer exatamente o que é, pra que vc nao se torne mais um, como diz o cv, “anemico stacktraceal”.[/quote]

Fala sério meu. E o fórum serve pra que ?

Resposta: No seu hibernate.cfg, provavelmente, esteja usando o método Configuration, mas como você está configurando mapas de anotações, refatore ele para: AnnotationConfiguration!

abraços!

Estou tendo o mesmo erro :frowning:

Ha…descobri o pq…tinha faltado o no hibernate.cfg.xml

Mas tenho uma dúvida. Mesmo no hibernate 3 é necessário mapear tudo na mão?