-->
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: Mapping one-to-many
PostPosted: Mon May 28, 2007 7:05 pm 
Newbie

Joined: Sat May 19, 2007 12:02 pm
Posts: 19
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3

Mapping documents:

<hibernate-mapping>
<class name="billing.model.Account" table="Account">
<id name="id" type="int" column="id">
<generator class="assigned" />
</id>
<property name="firstName">
<column name="firstName" />
</property>
<property name="lastName">
<column name="lastName" />
</property>
<property name="email">
<column name="email" />
</property>
<property name="address">
<column name="address" />
</property>
<property name="phone">
<column name="phone" />
</property>
<property name="fax">
<column name="fax" />
</property>
<map name="invoices">
<key column="customerID" not-null="true" update="false" />
<map-key column="customerID" type="integer" />
<one-to-many class="billing.model.Invoice" />
</map>
</class>
</hibernate-mapping>



Full stack trace of any exception that occurs:
org.hibernate.MappingException: Repeated column in mapping for entity: billing.model.Invoice column: customerID (should be mapped with insert="false" update="false")
org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
org.hibernate.mapping.RootClass.validate(RootClass.java:192)


Problems with Session and transaction handling? No

Read this: http://hibernate.org/42.html

How do I map one account to many invoices ?
What's the best to use in this case ? List, Map, Array .. ?
Thank you for help.



[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 28, 2007 10:23 pm 
Newbie

Joined: Tue Dec 05, 2006 7:40 am
Posts: 14
Hi Mansour,

I think that it http://forum.hibernate.org/viewtopic.php?t=975279&highlight= can helpfull for you.

another tip is put your ddl those entities(Account,Invoice).


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.