-->
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.  [ 3 posts ] 
Author Message
 Post subject: debugging table creation
PostPosted: Fri Mar 09, 2007 9:49 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
Hibernate version:3.2.1
Name and version of the database you are using:MySQL 5

i have two hibernate.map in two differenet mapping files. these two definitinos are almost the same, but just one creates the table defined in the mapping file, the other one doesnot. The objects referenced in the map do not have a reference back (one object just has simple properties, the other object has a hibernate.list and some simple properties)

This one creates the table "user_def_fields_id_to_field"
Code:
<map
            name="idsToUserDefField"
            table="user_def_fields_id_to_field"
            lazy="false"
            sort="unsorted"
            cascade="all"
        >

            <key
                column="user_def_fields_id"
            >
            </key>

            <index
                column="mapkey"
                type="java.lang.String"
            />

            <one-to-many
                  class="com.seqis.kltm.model.db.project.UserDefField"
            />

</map>


This one does not create the table "xxx_yyy_filter_values"
Code:
       
<map
            name="values"
            table="xxx_yyy_filter_values"
            lazy="false"
            sort="unsorted"
            cascade="all"
        >

            <key
                column="filter_model_id"
            >
            </key>

            <index
                column="mapkey"
                type="java.lang.String"
            />

            <one-to-many
                  class="com.seqis.kltm.model.db.project.filter.ProjectFilterModelValues"
            />

</map>


so if possible i want to debug through the table creation to find my mistake. so where does hibernate read the hbm.xml files and generates the sql syntax? or is my mistake trivial but im too blind to see?

thx


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 5:03 am 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
You can set this property in hibernate.cfg.xml:

<property name="hibernate.show_sql">true</property>

This will show you all the SQL statements generated.

Also turn up logging level for org.hibernate.

The other thing to check is that do you have both mapping files added to hibernate.cfg.xml?

Budyanto


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 9:26 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
thx for your advice. i will check on monday.
both files are added to the config. the other properties and "main" tables were created, just the one link is missing.


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.