Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: error schemaexport chapter 2
PostPosted: Wed Mar 10, 2010 5:40 am 
Newbie

Joined: Wed Mar 10, 2010 4:11 am
Posts: 11
Hello, I'm in chapter two, before the annotations, I managed to run the program, but to give DBManager, and see the HSQL Database Manager window, not in SQL Console shows me the phrase "select * from message" MESSAGE_ID , MESSAGE_TEXT and NEXT_MESSAGE_ID fields. SchemaExport I tried to run but gives me an error, this is the trace:

Buildfile: C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\build.xml
clean:
[delete] Deleting directory C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\bin
[mkdir] Created dir: C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\bin
compile:
[javac] Compiling 3 source files to C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\bin
copymetafiles:
[copy] Copying 3 files to C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\bin
schemaexport:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2ddl (Generates database schema)
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.3.2.GA
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : javassist
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Configuration addResource
[hibernatetool] INFO: Reading mappings from resource : hello/Message.hbm.xml
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
[hibernatetool] INFO: Mapping class: hello.Message -> MESSAGES
[hibernatetool] 10-mar-2010 10:30:27 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] 10:30:28,025
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

BUILD FAILED
C:\Documents and Settings\empalacios\workspaceManningJP\HelloWorldJP\build.xml:64: org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

Total time: 2 seconds

I do not know if I miss some library, which I have are: antlr-2.7.6.jar, asm-attrs.jar, asm.jar, c3p0-0.90.1.jar, cglib-2.2.jar, commons-collections - 3.1.jar, commons-loggin-1.0.4.jar, dom4j-1.6.1.jar, freemarker.jar, hibernate-tools.jar, hibernate3.jar, hsqldb.jar, javassist.jar, jta-1.1.jar, log4j-1.2.15.jar, slf4j-api-1.5.3.jar and slf4j-jdk14-1.4.2.jar. And my build.xml is:

Code:
<project name="HelloWorldJP" default="compile" basedir=".">
   
   <!-- Nombre y versión del proyecto-->
   <property name="proj.name" value="HelloWorldJP"/>
   <property name="proj.version" value="1.0"/>
   
   <!-- Propiedades globales para este constructor -->
   <property name="src.java.dir" value="src"/>
   <property name="lib.dir" value="lib"/>
   <property name="build.dir" value="bin"/>
   
   <!-- Declaración del classpath -->
   <path id="project.classpath">
      <fileset dir="${lib.dir}">
         <include name="**/*.jar"/>
         <include name="**/*.zip"/>         
      </fileset>
   </path>

   <!-- Accesos directos útiles -->
   <patternset id="meta.files">
      <include name="**/*.xml"/>
      <include name="**/*.properties"/>
   </patternset>
   
   <!-- Limpieza -->
   <target name="clean">
      <delete dir="${build.dir}"/>
      <mkdir dir="${build.dir}"/>
   </target>
   
   <!-- Compilar las fuentes de java -->
   <target name="compile" depends="clean">
      <mkdir dir="${build.dir}"/>
      <javac srcdir="${src.java.dir}" destdir="${build.dir}" nowarn="on">
         <classpath refid="project.classpath"/>
      </javac>
   </target>
   
   <!-- Copia de metadatos para construir el classpath -->
   <target name="copymetafiles">
      <copy todir="${build.dir}">
         <fileset dir="${src.java.dir}">
            <patternset refid="meta.files"/>
         </fileset>
      </copy>
   </target>
   
   <!-- Ejecutando HelloWorldJP -->
   <target name="run" depends="compile, copymetafiles"
      description="Build and run HelloWorldJP">
      <java fork="true" classname="hello.HelloWorld"
         classpathref="project.classpath">
         <classpath path="${build.dir}"/>
      </java>
   </target>
   
   <!-- Schema Export -->
   
   <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="project.classpath" />
   
   <target name="schemaexport" depends="compile, copymetafiles"
            description="Exports a generated schema to DB and file">
      <hibernatetool destdir="${basedir}">
         <classpath path="${build.dir}"/>
         <configuration configurationfile = "${build.dir}/hibernate.cfg.xml"/>
         <!-- El exportador es hbm2ddl. Si drop=true, las declaraciones drop de sql son generadas primero y todas las tablas y ctes que
         existan seran borradas antes de eso. Si create=true, las declaraciones sql son creadas después, creando
         todas las tablas y ctes. Si export=true, todas las declaraciones ddl son directamente ejecutadas en bbdd,
         abriendo una conexion con la bbdd encontrada en el fichero de configuracion-->
         <hbm2ddl drop="true" create="true" export="true"
            outputfilename="helloworld-ddl.sql" delimiter=";" format="true"/>
      </hibernatetool>
   </target>

   <target name="dbmanager" description="Start HSQL DB manager">
      <java classname="org.hsqldb.util.DatabaseManagerSwing"
         fork="yes" classpathref="project.classpath" failonerror="true">
         <arg value="-url"/>
         <arg value="jdbc:hsqldb:hsql://localhost/"/>
         <arg value="-driver"/>
         <arg value="org.hsqldb.jdbcDriver"/>
      </java>
   </target>

</project>   


and my hibernate.cfg.xml:
Code:
<!DOCTYPE hibernate-configuration SYSTEM
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
   <session-factory>
      <property name="hibernate.connection.driver_class">
         org.hsqldb.jdbcDriver
      </property>
      <property name="hibernate.connection.url">
         jdbc:hsqldb:hsql://localhost
      </property>
      <property name="hibernate.connection.username">
         sa
      </property>
      <property name="hibernate.dialet">
         org.hibernate.dialect.HSQLDialect
      </property>
      
      <!-- Usando la conexión de c3p0 -->
      <!-- Valor mínimo de conexiones JDBC que C3PO puede mantener -->
      <property name="hibernate.c3p0.min_size">5</property>
      <!-- Valor máximo de conexiones que el pool puede mantener, si se pasa, lanzará una excepcion -->
      <property name="hibernate.c3p0.max_size">20</property>
      <!-- Periodo de tiempo después del cual la conexión será borrada -->
      <property name="hibernate.c3p0.timeout">300</property>
      <property name="hibernate.c3p0.max_statements">50</property>
      <property name="hibernate.c3p0.idle_text_period">3000</property>
      
   
      
      <!-- Para mostrar e imprimir SQL y stdout -->
      <property name="show_sql">true</property>
      <property name="format_sql">true</property>

      
      
      <!-- lista de mapeo de documentos xml -->
      <mapping resource="hello/Message.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


Can anyone tell me what I'm missing? Thank you very much for your help, greetings


Top
 Profile  
 
 Post subject: Re: error schemaexport chapter 2
PostPosted: Wed Mar 10, 2010 8:35 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 988
Quote:
<property name="hibernate.dialet">


You must write 'dialect', not 'dialet'


Top
 Profile  
 
 Post subject: Re: error schemaexport chapter 2
PostPosted: Wed Mar 10, 2010 10:39 am 
Newbie

Joined: Wed Mar 10, 2010 4:11 am
Posts: 11
Hello, thank you very much for your help, I feel very foolish at this time because he could not see a foolish mistake. I think that I tried see a big error and I could not see an obvious error. Thanks for your time, greetings


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

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.