-->
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: Objekt wird nicht in Datenbank gespeichert (fehl. insert)
PostPosted: Mon Jun 19, 2006 4:42 am 
Newbie

Joined: Thu Jun 01, 2006 8:17 am
Posts: 10
Location: mostly lake of constance
Hibernate version: 3.0

Mapping Dateien:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="orm">
   <class name="ObjectItem" table="OBJ_ITEM">
      <meta attribute="class-description">Represents an Object Item</meta>
      <id name="id" column="obj_item_id" type="java.lang.Long">
         <generator class="native"/>
      </id>
      <property name="categoryCode" column="cat_code" type="string" length="6" not-null="true"/>
      <property name="name" column="name" type="string" length="100" not-null="true"/>
      <property name="alternateIdentificationText" column="altn_identific_txt" type="string" length="255"/>
      <property name="ownerId" column="owner_id" type="long" not-null="true"/>
      <property name="updateSeqNo" column="update_seqnr" type="long" not-null="true"/>
      <set name="capability" lazy="false" inverse="true" cascade="all">
         <key column="obj_item_id"/>
         <one-to-many class="ObjectItemCapability" />
      </set>
   </class>
</hibernate-mapping>


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="orm">
   <class name="ObjectItemCapability" table="OBJ_ITEM_CAPAB" >
      <meta attribute="class-description">Represents a Object Item Capability</meta>            
      <id name="id" column="obj_item_capab_ix" type="java.lang.Long">
         <generator class="native"/>
      </id>
      <many-to-one name="objectItem" class="ObjectItem"
         column="obj_item_id"
         update="false"
         insert="true"
         not-null="true" />
      <many-to-one name="capability" class="Capability"
         column="capab_id"
         update="false"
         insert="true"
         not-null="true"
         cascade="all"/>
      <property name="missionPrimacyCode" column="msn_primacy_code" type="string" length="6"/>
      <property name="reportingDataId" column="rptd_id" type="long"/>
      <property name="ownerId" column="owner_id" type="long" not-null="true"/>
      <property name="updateSeqNo" column="update_seqnr" type="long" not-null="true"/>
   </class>
</hibernate-mapping>

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="orm">
   <class name="Capability" table="CAPAB">
      <meta attribute="class-description">Represents a Capability</meta>
      <id name="id" column="capab_id" type="java.lang.Long">
         <generator class="native"/>
      </id>
      <property name="categoryCode" column="cat_code" type="string" length="6" not-null="true"/>
      <property name="subCategoryCode" column="sub_cat_code" type="string" length="6"/>
      <property name="dayNightCode" column="day_night_code" type="string" length="6"/>
      <property name="unitOfMeasureCode" column="uom_code" type="string" length="6"/>
      <property name="ownerId" column="owner_id" type="long" not-null="true"/>
      <property name="updateSeqNo" column="update_seqnr" type="long" not-null="true"/>
       <set name="storageCapabilities" table="STORAGE_CAPAB">
           <key column="storage_capab_id"/>
           <many-to-many column="mat_type_id" class="MaterialType" unique="true"/>
       </set>
   </class>
</hibernate-mapping>


Bin noch recht unerfahren in sachen hibernate und habe momentan folgendes Problem: Ich lege mir ein Objekt vom Typ ObjectItem an, indem wiederum ein Objekt der Klasse ObjektItemCapability und in dem wiederum ein Objekt Capability. Beim persistieren wird mir aber ein unexpected row count zurückgegeben. ein blick in die logs von hsql ergab, dass kein insert in die tabelle ObjektItemCapability stattfindet. weiß jemand warum ich das objektgebilde nicht in die datenbank bekomme?

[/code]


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.