Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Subclass und many-to-one
PostPosted: Sat Jul 16, 2011 3:16 am 
Newbie

Joined: Sat Jul 16, 2011 2:32 am
Posts: 1
Hey,

Ich hab zwei Klassen, welche über eine many-to-one-Beziehung verbunden sind.
Das sieht folgendermaßen aus:
Code:
<composite-id class="MActiveId" mapped="true">
            <key-property name="actorType" type="string">
                <column name="ACTOR_TYPE" length="16" />
            </key-property>
            <key-property name="actorId" type="java.lang.Long">
                <column name="ACTOR_ID" precision="22" scale="0" />
            </key-property>
        </composite-id>
        <discriminator column="ACTOR_TYPE" length="16" type="string" />
        <property column="ACTIVE_START" name="activeStart" type="timestamp"/>
        <property column="ACTIVE_END" name="activeEnd" type="timestamp"/>
        <subclass discriminator-value="MET" name="MeterActive">
            <many-to-one name="actor" class="TfmsMeters" foreign-key="ACTOR_ID" column="ACTOR_ID" />
        </subclass>
        ....


und

Code:
<class name="TfmsMeters" schema="tfms" table="TFMS_METERS">
    <id name="id" type="java.lang.Long">
      <column name="ID" precision="22" scale="0"/>
      <generator class="assigned"/>
    </id>
    <one-to-one cascade="all" class="MeterActive" fetch="select" name="meterActive" property-ref="actor" />
    <many-to-one class="TfmsPresets" column="PRESET_ID" name="preset">
          </many-to-one>
    <property name="armNo" type="java.lang.Long">
      <column name="ARM_NO" not-null="true" precision="22" scale="0"/>
    </property>
    <property name="name" type="string">
      <column length="250" name="NAME"/>
    </property>
    <property name="CUser" type="string">
      <column length="64" name="C_USER"/>
    </property>
     ....


Ausgelesen kann alles werden, jedoch bekomm ich beim Einfügen eines neuen Objektes vom Typ TfmsMeters dauernd folgenden Fehler:
Code:
org.hibernate.exception.GenericJDBCException: could not insert: [PresetActive]
Caused by: java.sql.SQLException: Ungültiger Spaltenindex


Danke schon Mal :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.