-->
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: How to map table which doesnot have PRIM_KEY
PostPosted: Sun Jan 02, 2011 8:18 pm 
Newbie

Joined: Sun Jan 02, 2011 8:10 pm
Posts: 4
Hi. I want to map table which doesnot have PRIMARY_KEY.
I have two tables
Persons , and Cars(this table doesnot have PRIM_KEY, but has foregin key which is person_id_fk).
One person can have more cars than one. That is why i want to store cars as Set.
In Persons mapping file i wrote this
Code:
<set name="person_cars">
      <key column="person_id_fk"/>
      <one-to-many class="objects.Persons" />
</set>

But hibernate throws exception:
Code:
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not initialize a collection: [objects.Persons.person_cars#RIC]

Can you help me?


Top
 Profile  
 
 Post subject: Re: How to map table which doesnot have PRIM_KEY
PostPosted: Mon Jan 03, 2011 5:40 am 
Newbie

Joined: Sun Jan 02, 2011 8:10 pm
Posts: 4
Ok, everything works now.


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.