-->
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: Problem mit Hibernate Tool und ANT
PostPosted: Fri Jul 25, 2008 4:17 am 
Newbie

Joined: Fri Jul 25, 2008 4:03 am
Posts: 7
Hallo,

ich will mittels einem hibernate tool ant task java dateien aus einem Datenbankschema erzeugen.

Das Problem ist, dass er diese nicht erzeugt, ABER keinen Fehler bringt ...

hibernate.cfg.xml

Code:

<?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="connection.driver_class">com.mysql.jdbc.Driver</property>
       <property name="connection.url">jdbc:mysql://localhost:3306/schufa</property>
       <property name="connection.username">root</property>
        <property name="hibernate.hbm2ddl.auto">validate</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>


        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
       
    </session-factory>

</hibernate-configuration>


Mein Ant Task:

Code:
<project basedir="." default="hibernate">
<!--    <property name="jdbc.driver.jar" value="C:/Program Files/Oracle/ora91/jdbc/lib/ojdbc14.jar" /> -->

   <property name="jdbc.driver.jar" value="../../IWAModCore/lib/mysql-connector-java-5.1.6-bin.jar" />

   <path id="toolslib">
      <path location="../../IWAModCore/lib/hibernate-tools.jar" />
      <path location="../../IWAWeb/WebContent/WEB-INF/lib/hibernate3.jar" />
      <path location="../../IWAWeb/WebContent/WEB-INF/lib/freemarker-2.3.8.jar" />
      <path location="../../IWAWeb/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar" />
      <path location="../../IWAWeb/WebContent/WEB-INF/lib/dom4j-1.6.1.jar" />
      <path location="${jdbc.driver.jar}" />
   </path>
      
   <taskdef name="hibernatetool"
            classname="org.hibernate.tool.ant.HibernateToolTask"
            classpathref="toolslib" />
   
   <property name="gen.dir" location="${basedir}/hibernate/gen"/>
   

   <target name="hibernate">
      <mkdir dir="${gen.dir}"/>
      <hibernatetool destdir="${gen.dir}">
         <configuration configurationfile="../src/hibernate.cfg.schufa.xml"/>      
         <hbm2java ejb3="true" jdk5="true" />
      </hibernatetool>
   </target>

</project>


Die Ausgabe:

Code:
parsing buildfile C:\Workspaces\workspace_iwa\IWAModSchufa\hibernate\build.xml with URI = file:///C:/Workspaces/workspace_iwa/IWAModSchufa/hibernate/build.xml
Project base dir set to: C:\Workspaces\workspace_iwa\IWAModSchufa\hibernate
Build sequence for target(s) `hibernate' is [hibernate]
Complete build sequence is [hibernate, ]
hibernate:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 24.07.2008 16:19:16 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.6
[hibernatetool] 24.07.2008 16:19:16 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] 24.07.2008 16:19:16 org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] 24.07.2008 16:19:16 org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 24.07.2008 16:19:17 org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.schufa.xml
[hibernatetool] 24.07.2008 16:19:17 org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] 24.07.2008 16:19:17 org.hibernate.tool.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.1.GA
BUILD SUCCESSFUL
Total time: 907 milliseconds


Was ich halt ein bisschen komisch finde, ist, dass die SessionFactory null ist.

Mit der Configuration oben konnte ich aber schon ne Abfrage in meiner Anwendung machen, das ging einwandfrei ohne Fehler...

Bin ein bisschen ratlos...


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.