-->
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 creating table(intermediate) using hibernate
PostPosted: Thu Apr 07, 2005 4:49 am 
Newbie

Joined: Thu Apr 07, 2005 4:32 am
Posts: 1
Hibernate version: 2.1

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Person">
<id name="id" column="personId" type="int">
<generator class="native"/>
</id>
<join table="PersonAddress"
optional="true">
<key column="personId" unique="true"/>
<many-to-one name="address"
column="addressId"
not-null="true"/>
</join>
</class>

<class name="Address">
<id name="id" column="addressId" type="int">
<generator class="native"/>
</id>
</class>

</hibernate-mapping>


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

Full stack trace of any exception that occurs:

Name and version of the database you are using: MYSQL version 3.1

The generated SQL (show_sql=true):
[schemaexport] drop table if exists Address;
[schemaexport] 14:14:06,368 DEBUG SchemaExport:132 - drop table if exists Address;
[schemaexport] drop table if exists Person;
[schemaexport] 14:14:06,368 DEBUG SchemaExport:132 - drop table if exists Person;
[schemaexport] create table Address (
[schemaexport] addressId integer not null auto_increment,
[schemaexport] primary key (addressId)
[schemaexport] );
[schemaexport] 14:14:06,368 DEBUG SchemaExport:149 - create table Address (
[schemaexport] addressId integer not null auto_increment,
[schemaexport] primary key (addressId)
[schemaexport] );
[schemaexport] create table Person (
[schemaexport] personId integer not null auto_increment,
[schemaexport] primary key (personId)
[schemaexport] );
[schemaexport] 14:14:06,383 DEBUG SchemaExport:149 - create table Person (
[schemaexport] personId integer not null auto_increment,
[schemaexport] primary key (personId)
[schemaexport] );
[schemaexport] 14:14:06,399 INFO SchemaExport:160 - schema export complete
BUILD SUCCESSFUL
Total time: 5 seconds

Debug level Hibernate log excerpt:

Hi All,
I am new to hibernate. I just want to create two classes and want to establish relation between them
i am able to everything but its not creating PersonAddress table that is mentioned. Can i know y it is not creating the Table. I am able to create Person and Address. Please help me...
Thanks
Madhuri


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.