-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: I cant create a table using the hibernate SchemaExport
PostPosted: Wed Dec 12, 2007 2:07 pm 
Newbie

Joined: Wed Dec 12, 2007 1:58 pm
Posts: 5
Hi all,

I try to create a table using the SchemaExport, but i cant. When i run my main code, there is no errors on output console. Anyone can help me?

My main code:

Code:
package br.org.xxxxxxxxxx.hibernate;

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


public class CreateTable {

   public static void main(String[] args) {

      Configuration configuration = new AnnotationConfiguration();
      configuration.configure();

      SchemaExport se = new SchemaExport(configuration);
      se.create(true, true);


   }

}




My bean model:

Code:
package br.org.xxxxxxxx.jdbc.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Entity
public class User {

   @Id
   @GeneratedValue
   private long id;
   private String name;
   private String login;
   private String passwd;

   public long getId() {
      return id;
   }
   public void setId(long id) {
      this.id = id;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
   public String getPasswd() {
      return passwd;
   }
   public void setPasswd(String passwd) {
      this.passwd = passwd;
   }
   public String getLogin() {
      return login;
   }
   public void setLogin(String login) {
      this.login = login;
   }


}




my hibernate.cfg.xml:

Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>

<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/mydatabase</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">xxxxx</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>


</session-factory>
</hibernate-configuration>




Hibernate version: 3.2.5.GA

Hibernate Annotation version: 3.3.0.GA

Full stack trace of any exception that occurs: none

Name and version of the database you are using: Postgresql 8

The generated SQL:
Quote:
14:37:07,703 INFO Version:15 - Hibernate Annotations 3.2.1.GA
14:37:07,718 INFO Environment:514 - Hibernate 3.2.5
14:37:07,718 INFO Environment:547 - hibernate.properties not found
14:37:07,734 INFO Environment:681 - Bytecode provider name : cglib
14:37:07,734 INFO Environment:598 - using JDK 1.4 java.sql.Timestamp handling
14:37:07,859 INFO Configuration:1426 - configuring from resource: /hibernate.cfg.xml
14:37:07,859 INFO Configuration:1403 - Configuration resource: /hibernate.cfg.xml
14:37:08,156 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
14:37:08,156 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
14:37:08,156 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
14:37:08,203 DEBUG Configuration:1387 - connection.driver_class=org.postgresql.Driver
14:37:08,203 DEBUG Configuration:1387 - connection.password=xxxxxxx
14:37:08,203 DEBUG Configuration:1387 - connection.url=jdbc:postgresql://localhost:5432/mydatabase
14:37:08,203 DEBUG Configuration:1387 - connection.username=postgres
14:37:08,203 DEBUG Configuration:1387 - dialect=org.hibernate.dialect.PostgreSQLDialect
14:37:08,203 DEBUG Configuration:1387 - show_sql=true
14:37:08,203 DEBUG Configuration:1387 - format_sql=true
14:37:08,203 DEBUG Configuration:1387 - hbm2ddl.auto=create
14:37:08,203 DEBUG Configuration:1387 - connection.autocommit=true
14:37:08,203 INFO Configuration:1541 - Configured SessionFactory: null
14:37:08,203 DEBUG Configuration:1542 - properties: {hibernate.connection.password=xxxxxxx, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, sun.boot.library.path=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\bin, java.vm.version=1.5.0_09-b01, hibernate.connection.username=postgres, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=BR, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Documents and Settings\myfolder\workspace\mydatabase, java.runtime.version=1.5.0_09-b01, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, hbm2ddl.auto=create, java.endorsed.dirs=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\endorsed, os.arch=x86, hibernate.connection.autocommit=true, java.io.tmpdir=C:\DOCUME~1\EDUARD~1.CRE\CONFIG~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Arquivos de programas\Seagate Software\NOTES\;C:\Arquivos de programas\Seagate Software\NOTES\DATA\;C:\oracle\ora92\bin;C:\IBMDebug\bin;C:\Arquivos de programas\Oracle\jre\1.3.1\bin;C:\Arquivos de programas\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\Arquivos comuns\Roxio Shared\DLLShared\;C:\Arquivos de programas\MySQL\MySQL Server 5.0\bin;C:\Sun\AppServer\bin;;C:\ARQUIV~1\E!PC, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, connection.password=xxxxxxx, user.home=C:\Documents and Settings\myfolder, user.timezone=America/Sao_Paulo, connection.username=postgres, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.format_sql=true, hibernate.connection.driver_class=org.postgresql.Driver, show_sql=true, user.name=myfolder, java.class.path=C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\classes;C:\jboss-4.0.3SP1\client\jboss-j2ee.jar;C:\jboss-4.0.3SP1\client\jbossall-client.jar;C:\jboss-4.0.3SP1\server\default\lib\javax.servlet.jar;C:\jboss-4.0.3SP1\server\default\lib\javax.servlet.jsp.jar;C:\jboss-4.0.3SP1\server\default\lib\activation.jar;C:\jboss-4.0.3SP1\server\default\lib\mail.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\antlr-2.7.2.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\bsf-2.3.0.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-beanutils-1.7.0.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-beanutils.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-chain-1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-collections-3.2.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-digester-1.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-fileupload-1.1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-io-1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-lang-2.3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-logging-1.0.4.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-validator-1.3.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\dom4j-1.6.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\ejb3-persistence.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\hibernate-annotations.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\hibernate3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\itext-2.0.6.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\jstl.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\log4j-1.2.15.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\mysql-connector-java-3.1.11-bin.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\oro-2.0.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\poi.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\standard.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-core-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-el-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-extras-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-faces-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-mailreader-dao-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-scripting-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-taglib-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-tiles-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\dom4j-1.6.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\hibernate3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\ejb3-persistence.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\log4j-1.2.15.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\antlr-2.7.2.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\bsf-2.3.0.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-beanutils.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-beanutils-1.7.0.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-chain-1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-collections-3.2.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-digester-1.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-fileupload-1.1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-io-1.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-lang-2.3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-logging-1.0.4.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\commons-validator-1.3.1.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\itext-2.0.6.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\jstl.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\oro-2.0.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\poi.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\standard.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-core-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-el-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-extras-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-faces-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-mailreader-dao-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-scripting-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-taglib-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\struts-tiles-1.3.8.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\hibernate-annotations.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\aspectjrt.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\aspectjtools.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\xercesImpl.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\classes12.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\postgresql-8.2-507.jdbc3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\ehcache-1.2.3.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\jta.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\asm.jar;C:\Documents and Settings\myfolder\workspace\mydatabase\web\WEB-INF\lib\cglib-2.1.3.jar, format_sql=true, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://localhost:5432/mydatabase, user.language=pt, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.5.0_09, java.ext.dirs=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\ext, sun.boot.class.path=C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\rt.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\i18n.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\sunrsasign.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\jsse.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\jce.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\lib\charsets.jar;C:\Arquivos de programas\EasyEclipse Server Java 1.2.2.2\jre\jre\classes, java.vendor=Sun Microsystems Inc., connection.driver_class=org.postgresql.Driver, file.separator=\, hibernate.hbm2ddl.auto=create, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, connection.autocommit=true, sun.desktop=windows, connection.url=jdbc:postgresql://localhost:5432/mydatabase, dialect=org.hibernate.dialect.PostgreSQLDialect, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}
14:37:08,234 INFO Dialect:152 - Using dialect: org.hibernate.dialect.PostgreSQLDialect
14:37:08,296 DEBUG AnnotationConfiguration:235 - Execute first pass mapping processing
14:37:08,343 DEBUG AnnotationConfiguration:435 - Process hbm files
14:37:08,359 DEBUG AnnotationConfiguration:443 - Process annotated classes
14:37:08,359 DEBUG AnnotationConfiguration:329 - processing manytoone fk mappings
14:37:08,359 DEBUG Configuration:1120 - processing extends queue
14:37:08,359 DEBUG Configuration:1124 - processing collection mappings
14:37:08,359 DEBUG Configuration:1135 - processing native query and ResultSetMapping mappings
14:37:08,359 DEBUG Configuration:1143 - processing association property references
14:37:08,359 DEBUG Configuration:1165 - processing foreign key constraints
14:37:08,359 DEBUG AnnotationConfiguration:235 - Execute first pass mapping processing
14:37:08,359 DEBUG AnnotationConfiguration:435 - Process hbm files
14:37:08,359 DEBUG AnnotationConfiguration:443 - Process annotated classes
14:37:08,359 DEBUG AnnotationConfiguration:329 - processing manytoone fk mappings
14:37:08,359 DEBUG Configuration:1120 - processing extends queue
14:37:08,359 DEBUG Configuration:1124 - processing collection mappings
14:37:08,359 DEBUG Configuration:1135 - processing native query and ResultSetMapping mappings
14:37:08,359 DEBUG Configuration:1143 - processing association property references
14:37:08,359 DEBUG Configuration:1165 - processing foreign key constraints
14:37:08,359 INFO SchemaExport:154 - Running hbm2ddl schema export
14:37:08,359 DEBUG SchemaExport:170 - import file not found: /import.sql
14:37:08,359 INFO SchemaExport:179 - exporting generated schema to database
14:37:08,375 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
14:37:08,375 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
14:37:08,375 INFO DriverManagerConnectionProvider:45 - autocommit mode: true
14:37:08,406 INFO DriverManagerConnectionProvider:80 - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/mydatabase
14:37:08,406 INFO DriverManagerConnectionProvider:83 - connection properties: {user=postgres, password=xxxxxxx, autocommit=true}
14:37:08,406 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
14:37:08,406 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
14:37:08,578 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:postgresql://localhost:5432/mydatabase, Isolation Level: 2
14:37:08,578 INFO SchemaExport:196 - schema export complete
14:37:08,578 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
14:37:08,578 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:postgresql://localhost:5432/mydatabase


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.