-->
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.  [ 2 posts ] 
Author Message
 Post subject: foreign key relations not resolved
PostPosted: Mon Mar 02, 2009 6:51 am 
Newbie

Joined: Mon Mar 02, 2009 6:42 am
Posts: 6
Hibernate version:
Hibernate 3

Name and version of the database you are using:
MySQL 5

MySQL Driver Version
5.1.7 and 5.0.8

Hibernate does not resolve foreign key relations

SQL:
Code:
CREATE  TABLE IF NOT EXISTS `test`.`item` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `reconstruction_id` INT NOT NULL ,
  `type` VARCHAR(45) NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `item_FKIndex1` (`reconstruction_id` ASC) ,
  CONSTRAINT `Rel_55`
    FOREIGN KEY (`reconstruction_id` )
    REFERENCES `test`.`reconstruction` (`id` ))
PACK_KEYS = 0
ROW_FORMAT = DEFAULT;



Mapping File:
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">
<!-- Generated 02.03.2009 11:45:10 by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
    <class name="io.database.autogenerated.DBItem" table="item" catalog="test">
        <comment></comment>
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="increment" />
        </id>
        <property name="reconstructionId" type="int">
            <column name="reconstruction_id" not-null="true">
                <comment></comment>
            </column>
        </property>
        <property name="type" type="java.lang.Boolean">
            <column name="type">
                <comment></comment>
            </column>
        </property>
    </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 05, 2009 6:10 am 
Newbie

Joined: Mon Mar 02, 2009 6:42 am
Posts: 6
Sorry I found my own mistake. I choose the engine MyISAM, and now I change it to InnoDB.


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