-->
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.  [ 4 posts ] 
Author Message
 Post subject: hbm2ddl doesn't generate my table
PostPosted: Fri Nov 26, 2004 8:22 am 
Hello all,

My problem is simple schemaexport doesn't generate my table.

Hibernate version: 2.1.6

Config file:
Code:
<!DOCTYPE hibernate-configuration PUBLIC
   "-//Hibernate/Hibernate Configuration DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
   <session-factory name="FostisWeb" >
      <property name="connection.datasource">java:comp/env/jdbc/fostisweb</property>
      <property name="show_sql">false</property>
      <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

      <mapping resource="csc/fostis/bean/Employee.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


hibernate.properties:
Code:
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/fostisweb
hibernate.connection.username=test
hibernate.connection.password=test
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect



Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
    <class
        name="csc.fostis.bean.Employee"
        table="employeetest"
        proxy="csc.fostis.bean.Employee"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
        mutable="true"
    >

        <id
            name="employeeId"
            column="employee_id"
            type="int"
            unsaved-value="0"
        >
            <generator class="identity">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Employee.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="sapNb"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="sap_nb"
            not-null="false"
            unique="true"
        />

        <property
            name="firstName"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="employee_first_name"
            not-null="true"
            unique="false"
        />

        <property
            name="lastName"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="employee_last_name"
            not-null="true"
            unique="false"
        />

        <property
            name="status"
            type="char"
            update="true"
            insert="true"
            access="property"
            column="employee_status"
            not-null="true"
            unique="false"
        />

        <property
            name="staffingRemarks"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="staffing_remarks"
            not-null="false"
            unique="false"
        />

        <property
            name="actionPlanned"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="action_planned"
            not-null="false"
            unique="false"
        />

        <property
            name="decisionDate"
            type="java.util.Date"
            update="true"
            insert="true"
            access="property"
            column="decision_date"
            not-null="false"
            unique="false"
        />

        <property
            name="language"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="language"
            not-null="true"
            unique="false"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Employee.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
[schemaexport] 13:10:00,418 INFO Environment:469 - Hibernate 2.1.6
[schemaexport] 13:10:00,428 INFO Environment:503 - loaded properties from resource hibernate.properties: {hibernate.connection.username=cofo, hibernate.connection.password=cofo, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/fostisweb, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
[schemaexport] 13:10:00,448 INFO Environment:529 - using CGLIB reflection optimizer
[schemaexport] 13:10:00,468 INFO Configuration:929 - configuring from file: hibernate.cfg.xml
[schemaexport] 13:10:00,739 INFO Configuration:331 - Mapping resource: csc/fostis/bean/Employee.hbm.xml
[schemaexport] 13:10:00,999 INFO Binder:229 - Mapping class: csc.fostis.bean.Employee -> employeetest
[schemaexport] 13:10:01,199 INFO Configuration:1053 - Configured SessionFactory: FostisWeb
[schemaexport] 13:10:01,249 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
[schemaexport] 13:10:01,259 INFO Configuration:627 - processing one-to-many association mappings
[schemaexport] 13:10:01,269 INFO Configuration:636 - processing one-to-one association property references
[schemaexport] 13:10:01,269 INFO Configuration:661 - processing foreign key constraints
[schemaexport] 13:10:01,350 INFO Configuration:627 - processing one-to-many association mappings
[schemaexport] 13:10:01,360 INFO Configuration:636 - processing one-to-one association property references
[schemaexport] 13:10:01,360 INFO Configuration:661 - processing foreign key constraints
[schemaexport] 13:10:01,380 INFO SchemaExport:98 - Running hbm2ddl schema export
[schemaexport] 13:10:01,380 INFO SchemaExport:112 - writing generated schema to file: schema.sql
[schemaexport] drop table if exists employeetest;
[schemaexport] 13:10:01,390 DEBUG SchemaExport:132 - drop table if exists employeetest;
[schemaexport] 13:10:01,400 INFO SchemaExport:160 - schema export complete
BUILD SUCCESSFUL
Total time: 3 seconds

Name and version of the database you are using: MySql 4.1.7

The generated SQL (show_sql=true): Nothing except the drop SQL command. That's my problem!

Debug level Hibernate log excerpt: debug


Top
  
 
 Post subject:
PostPosted: Mon Nov 29, 2004 9:27 am 
I found the solution. The problem was in my ANT build file. I've set the schemaexport option to "yes". And then I've received only the drop SQL command in my schema file.


Top
  
 
 Post subject: Schemaexport non generating tables
PostPosted: Tue Jan 04, 2005 9:33 am 
Newbie

Joined: Thu Dec 09, 2004 8:25 am
Posts: 2
NiGhMa wrote:
I found the solution. The problem was in my ANT build file. I've set the schemaexport option to "yes". And then I've received only the drop SQL command in my schema file.


Could you please write which option you set to "yes".
I use hyperjaxb (hibernate + jaxb + xdoclet) on a mysql db and I get the same problem of non generated tables (which are named in the mapping files).

cheers,


Jerome


Top
 Profile  
 
 Post subject: Re: Schemaexport non generating tables
PostPosted: Fri Feb 11, 2005 2:28 pm 
Newbie

Joined: Fri Feb 11, 2005 10:23 am
Posts: 4
Location: Developer
He probably had the "drop" option set to yes.

jbaton wrote:
NiGhMa wrote:
I found the solution. The problem was in my ANT build file. I've set the schemaexport option to "yes". And then I've received only the drop SQL command in my schema file.


Could you please write which option you set to "yes".
I use hyperjaxb (hibernate + jaxb + xdoclet) on a mysql db and I get the same problem of non generated tables (which are named in the mapping files).

cheers,


Jerome


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.