-->
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: Generate SQL from hbm-files
PostPosted: Mon Nov 06, 2006 10:18 am 
Regular
Regular

Joined: Wed Nov 01, 2006 2:17 pm
Posts: 78
Hi,

I'm searching for a tool to generate SQL CREATE TABLE and those statements from Hibernate Mapping files (*.hbm.xml) for a MySQL 5 database.

Are there solutions for that?

Thanks in advance.

Hibernate version: 3

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="de.tfhberlin.eclipsophone.server.beans" auto-import="true">
  <class name="User" table="Users">
    <id name="id" column="id" type="long" unsaved-value="0">
      <generator class="native"/>
    </id>
    <property name="name" column="name" type="string"/>
    <property name="password" column="password" type="string"/>
    <set name="subscribed_groups" table="UserGroups" inverse="true">
       <key column="user_id"/>
      <many-to-many class="Group" column="group_id"/>
    </set>   
  </class>
</hibernate-mapping>


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="de.tfhberlin.eclipsophone.server.beans" auto-import="true">
  <class name="UserGroup" table="UserGroups">
    <id name="id" column="id" type="long" unsaved-value="0">
      <generator class="native"/>
    </id>
    <property name="user_id" column="user_id" type="long"/>
    <property name="group_id" column="group_id" type="long"/>
  </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 11:00 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
Yes there are tools for that. The Hibernate one is documented here:
http://www.hibernate.org/hib_docs/v3/re ... guide.html

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 06, 2006 11:04 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
It is covered in a couple places in documentation:

http://www.hibernate.org/hib_docs/v3/re ... figuration
http://www.hibernate.org/hib_docs/v3/re ... n-optional
http://www.hibernate.org/hib_docs/v3/re ... etguide-s1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 10:04 am 
Regular
Regular

Joined: Wed Nov 01, 2006 2:17 pm
Posts: 78
Thanks!


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.