-->
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: many-to-one inside of subclass???
PostPosted: Fri Dec 23, 2005 3:50 am 
Newbie

Joined: Thu Dec 22, 2005 7:23 am
Posts: 4
hi @all,
i'm a newbie in topic hibernate and develop my first project whit it. now i have a problem in storing datas to my database. my class-hierarchy looks like the following:

-------------------------
| person |
| |
-------------------------
/|\
|
------------------------- -------------------------
| customer |1 n| account |
| |--------------------| |
------------------------- -------------------------

customer inherit from person. customer has one or more accounts. the mapping lokes like:
Code:
<class name="Person" table="Person">
  ......
  <joined-subclass name="customer" table="customer">
   <key column="id" ></key>
   <property name="..."  type="...">
     <column name="..."/>
   </property>
  ......
 
   <many-to-one name="account" column="account_id" class="Account" cascade="all" lazy="false"/>
  </joined-subclass>
  ......
</class>


with this mapping i get the follow exception:

org.hibernate.exception.GenericJDBCException: could not insert: [customer]

when i delete the line containing the "many-to-one"-relation it works.

thx for help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 5:47 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
if a customer can have many accounts the relationship is one-to-many inside a set or other collection.

HTH,
radu


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 8:08 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Can you post the code you are executing and the full exception trace?

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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.