-->
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: Repeated column in mapping for entity - aber warum?
PostPosted: Sat Dec 10, 2011 1:59 pm 
Newbie

Joined: Sat Dec 10, 2011 1:49 pm
Posts: 2
Hallo,

diese Geschichte möchte ich mappen:

<!-- Medium -->
<!-- Zu mappende Attribute: erscheinungsjahr, medienart, preis, signatur, titel -->
<entity class="Medium" access="FIELD">
<!-- Vererbung liegt vor: -->
<inheritance/>
<discriminator-column name="MARTID" />

<attributes>
<id name="signatur">
<column name="SIGNATUR" />
<!-- Automatische Erzeugung von Schlüsselwerten -->
<generated-value strategy="AUTO" />
</id>
<basic name="titel">
<column name="TITEL" />
</basic>
<basic name="erscheinungsjahr">
<column name="ERSCHEINUNGSJAHR" />
</basic>
<basic name="preis">
<column name="WIEDERBESCHAFFUNGSPREIS" />
</basic>
<many-to-one name="medienart" fetch="LAZY">
<join-column name="MARTID" />
</many-to-one>
</attributes>
</entity>

<!-- Buch -->
<!-- Zu mappende Attribute: isbn -->
<entity class="Buch" access="FIELD">
<discriminator-value>1</discriminator-value>
<attributes>
<basic name="isbn" optional="false">
<column name="ISBN" />
</basic>
</attributes>
</entity>

<!-- Zeitschrift -->
<!-- Zu mappende Attribute: issn -->
<entity class="Zeitschrift">
<discriminator-value>2</discriminator-value>
<attributes>
<basic name="issn" optional="false">
<column name="ISSN" />
</basic>
</attributes>
</entity>

Nun erhalte ich aber den Fehler: Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: Buch column: MARTID (should be mapped with insert="false" update="false"). Aber MARTID muss ich doch zweimal angeben: Einmal um mitzuteilen, worin sich Buch und Zeitschrift unterscheiden und das zweite Mal um die Medienart auszugeben.

Warum ist das falsch?

Gruß Matthias


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.