Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: No row with the given identifier exists
PostPosted: Fri Mar 23, 2012 5:10 pm 
Newbie

Joined: Fri Mar 23, 2012 4:53 pm
Posts: 2
Hi,

ich bekomme immer beim Abfragen des Inventars die Fehlermeldung "No row with the given identifier exists" und denke das ich einen Fehler in meinen Mapping Dateien habe.
Kann mir jmd sagen ob ich da nen Fehler mache? Es scheint an der Composite ID zu liegen wenn ich mich nicht irre?

Es geht um die 2 Klassen Room und Inventarobject und es gibt eine One-To-Many Beziehung von Room zu Inventarobject.

Klassen:
Room:

Code:
    public class Room : IEntity {
        public Room() {
        }
        public virtual string Building { get; set; }
        public virtual string Roomno { get; set; }
        public virtual IList<Inventarobject> Inventarobjects { get; set; }

        public override bool Equals(object obj)
        {
            ...
        }

        public override int GetHashCode()
        {...}
    }


Inventarobject:

Code:
   public class Inventarobject : IEntity {
        public Inventarobject() {
         Archives = new List<Archive>();
         Tickets = new List<Ticket>();
        }
        public virtual long Inveturid { get; set; }
        public virtual Type Type { get; set; }
        public virtual Room Room { get; set; }
        public virtual IList<Archive> Archives { get; set; }
        public virtual IList<Ticket> Tickets { get; set; }
    }



Mappings:
Room:

Code:
  <class name="Room" table="ROOM" lazy="false" >
    <composite-id>
     
      <key-property name="Building" column="BUILDING" />
      <key-property name="Roomno" column="ROOMNO" />
    </composite-id>
    <bag name="Inventarobjects" inverse="true" cascade="save-update">
      <key>
        <column name="BUILDING"/>
        <column name="ROOMNO"/>
      </key>
      <one-to-many class="Inventarobject" />
    </bag>
  </class>


Inventarobject:
Code:
  <class name="Inventarobject" table="INVENTAROBJECT" lazy="false" >
    <id name="Inveturid" column="INVETURID" type="long">
      <generator class="identity" />
    </id>
    <many-to-one insert="false" column="MODELL" update="false" lazy="false" name="Type" not-null="true" class="Type">
    </many-to-one>
   
    <many-to-one insert="false"  update="false" lazy="false" name="Room" not-null="true" class="Room">
      <column name="ROOMNO"/>
      <column name="BUILDING" />
    </many-to-one>
     
    <bag name="Archives" inverse="true" cascade="none">
      <key column="INVETURID" />
      <one-to-many class="Archive" />
    </bag>
    <bag name="Tickets" inverse="true" cascade="none">
      <key column="INVETURID" />
      <one-to-many class="Ticket"  />
    </bag>
  </class>


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.