-->
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: Newbie: Possible with one-to-many where many is <any>
PostPosted: Fri Jan 14, 2005 5:42 am 
Newbie

Joined: Fri Jan 14, 2005 5:17 am
Posts: 6
Hello, I have problems determining if Hibernate can help me out on this one:

I have the following class hierarchy:

User

abstract Transaction superclass with subclasses:
TransactionA, TansactionB, TransactionC

The user has a one-to-many relationship to the Transaction classes, which can be many of each type.

I have the following database:
USER, TRANSACTIONA, TRANSACTIONB, TRANSACTIONC
Where TRANSACTIONA,B,C each has a foreign key to USER.
each table has a column ID, and the TRANSACTION tables uses the same sequence.

I would like to be able to refer to an abstract Transaction, so I implemented this with polymorphism:

<hibernate-mapping>
<class name="TransactionA" table="TRANSACTIONA" polymorphism="implicit" lazy="true">
<id name="id" column="ID" type="long">
<generator class="sequence">
<param name="sequence">SEQ_TRANSACTION</param>
</generator>
</id>

... and similar for TransactionB and C

I thought then that my User class could map to the abstract superclass Transaction:

<set name="transaksjoner" inverse="false" lazy="true">
<key column="OPPGJORSNR"/>
<one-to-many class= "Transaction"/>
</set>


This produced the following exception:
net.sf.hibernate.MappingException: Association references unmapped class: Transaction


So I thought that use of the <any> tag would do the trick, but I cannot find any examples on how to use <any> within a one-to-many. It does not seem that the DTD allows it either.

If anyone could help me out on this one, it would be greatly appreciated.

-Karl Ivar Dahl


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.