olá, estou tentando gerar uma tabela de acordo com a apostila do caelum utilizando o hibernate e o banco MySQL.
Porém ele nçao cria a tabela e eu não consigo identifica o erro… segue o erro
10:35:00,140 INFO Version:15 - Hibernate Annotations 3.2.1.GA
10:35:00,171 INFO Environment:509 - Hibernate 3.2.2
10:35:00,171 INFO Environment:527 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect, 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=root, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:mysql://localhost/teste, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1}
10:35:00,171 INFO Environment:558 - using java.io streams to persist binary types
10:35:00,171 INFO Environment:676 - Bytecode provider name : cglib
10:35:00,203 INFO Environment:593 - using JDK 1.4 java.sql.Timestamp handling
10:35:00,375 INFO Dialect:152 - Using dialect: org.hibernate.dialect.MySQLMyISAMDialect
10:35:00,453 DEBUG AnnotationConfiguration:235 - Execute first pass mapping processing
10:35:00,546 DEBUG AnnotationConfiguration:435 - Process hbm files
10:35:00,546 DEBUG AnnotationConfiguration:443 - Process annotated classes
10:35:00,546 DEBUG AnnotationConfiguration:329 - processing manytoone fk mappings
10:35:00,562 DEBUG Configuration:1120 - processing extends queue
10:35:00,562 DEBUG Configuration:1124 - processing collection mappings
10:35:00,562 DEBUG Configuration:1135 - processing native query and ResultSetMapping mappings
10:35:00,562 DEBUG Configuration:1143 - processing association property references
10:35:00,562 DEBUG Configuration:1165 - processing foreign key constraints
10:35:00,562 DEBUG AnnotationConfiguration:235 - Execute first pass mapping processing
10:35:00,562 DEBUG AnnotationConfiguration:435 - Process hbm files
10:35:00,578 DEBUG AnnotationConfiguration:443 - Process annotated classes
10:35:00,578 DEBUG AnnotationConfiguration:329 - processing manytoone fk mappings
10:35:00,578 DEBUG Configuration:1120 - processing extends queue
10:35:00,578 DEBUG Configuration:1124 - processing collection mappings
10:35:00,578 DEBUG Configuration:1135 - processing native query and ResultSetMapping mappings
10:35:00,578 DEBUG Configuration:1143 - processing association property references
10:35:00,578 DEBUG Configuration:1165 - processing foreign key constraints
10:35:00,578 INFO SchemaExport:154 - Running hbm2ddl schema export
10:35:00,578 DEBUG SchemaExport:170 - import file not found: /import.sql
10:35:00,578 INFO SchemaExport:179 - exporting generated schema to database
10:35:00,593 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
10:35:00,593 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
10:35:00,593 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
10:35:00,593 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/teste
10:35:00,593 INFO DriverManagerConnectionProvider:83 - connection properties: {user=root, password=root}
10:35:00,593 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
10:35:00,593 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
10:35:00,859 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:mysql://localhost/teste, Isolation Level: 4
10:35:00,859 INFO SchemaExport:196 - schema export complete
10:35:00,859 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
10:35:00,875 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:mysql://localhost/teste
BUILD SUCCESSFUL (total time: 2 seconds)
e o código java…
package br.com.localhost.hibernate;
import javax.xml.validation.Schema;
import javax.xml.validation.Validator;
import javax.xml.validation.ValidatorHandler;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.criterion.Property;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class GeraTabelas {
public static void main(String [] args){
AnnotationConfiguration cfg = new AnnotationConfiguration();
cfg.addAnnotatedClass(Produto.class);
new SchemaExport(cfg).create(true,true);
}
}
Se alguém souber e puder me dar a dica agradeço…
[/]'s a todos…