Criar tabelas com Hibernate a partir do mapeamento [RESOLVIDO]

Olá pessoal estou com duvida sobre o possibilidade ou não de poder criar as tabelas mapeadas no hibernate.

Usei o artigo http://javafree.uol.com.br/topic-857697-Gerar-Tabelas-com-Hibernate-e-Annotations.html
Para adaptar a classe

[code]import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class GeradorBanco {

 public static void main(String[] args) {
     AnnotationConfiguration  conf = new AnnotationConfiguration();
     conf.configure();
     conf.addAnnotatedClass(Usuario.class);
     SchemaExport se = new SchemaExport(conf);
     se.create(true, true);
 }

}[/code]

Porém está dando a seguinte mensagem

run: 24/07/2010 21:44:50 org.hibernate.cfg.annotations.Version <clinit> INFO: Hibernate Annotations 3.3.1.GA 24/07/2010 21:44:50 org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.2.5 24/07/2010 21:44:50 org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found 24/07/2010 21:44:50 org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : cglib 24/07/2010 21:44:50 org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling 24/07/2010 21:44:50 org.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml 24/07/2010 21:44:50 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml 24/07/2010 21:44:50 org.hibernate.cfg.Configuration addResource INFO: Reading mappings from resource : Usuario.hbm.xml 24/07/2010 21:44:50 org.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null 24/07/2010 21:44:50 org.hibernate.dialect.Dialect <init> INFO: Using dialect: org.hibernate.dialect.Oracle10gDialect Exception in thread "main" java.lang.NoClassDefFoundError: javax/persistence/Entity at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:258) at org.hibernate.cfg.Configuration.generateDropSchemaScript(Configuration.java:756) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:93) at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:61) at GeradorBanco.main(GeradorBanco.java:11) Caused by: java.lang.ClassNotFoundException: javax.persistence.Entity at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 5 more Java Result: 1 CONSTRUÍDO COM SUCESSO (tempo total: 0 segundos)
E não estou encontrando a tabela no Banco
e a seguinte propriedade está setada no hibernate.conf.xml

[code]create[/code
Algum luz ai ? :slight_smile:

no hibernate.cfg.xml voce precisa mapear suas classes …

isso com annotation , se voce usa xml dá uma procurada como proceder!

quando fiz este proceso usei esta classe

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;


public class GeraBanco {
	public static void main(String[] args) {
	AnnotationConfiguration conf = new AnnotationConfiguration();
	conf.configure();
        SchemaExport se = new SchemaExport(conf);
	se.create(true, true);
	}
}

Olá,

Olhe o erro:

Falta colocar o .jar ejb3-persistence.jar
É nele que estão as anotações básicas para trabalhar com entidades da JPA.
É uma das dependências do hibernate quando se usa anotações.

[]´s

Como eu faço para usar o anotations para isso?

Eu inclui o ejb3-persistence.jar e funcionou normalmente.
[]'s e obrigado a todos