-->
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: ObjectNotFoundException No row with the given identifier exi
PostPosted: Wed Mar 28, 2012 1:09 pm 
Newbie

Joined: Wed Mar 28, 2012 12:39 pm
Posts: 1
Can someone look whats the exact issue here. Let me know if you need further information on this.

1.
EmpInformation file contains the <composite-id> tag having many-to-one with Department Class

Code:
<hibernate-mapping>
    <class name="EmpInformation" table="emp_info" >

        <composite-id name="id" class="info">
               <key-property name="XXXid" type="int">
                    <column name="xxxid" />
               </key-property>
          <key-property name="AAA" type="string">
                    <column name="aaa" length="50" />
               </key-property>
               <key-property name="BBB" type="string">
                    <column name="bbb" length="50" />
               </key-property>
        </composite-id>

        <many-to-one name="Dept" class="Department" update="false" insert="false" fetch="select">
                    <column name="AAA" length="50" not-null="true" />
               <column name="BBB" length="50" not-null="true" />
        </many-to-one>
       
    </class>
</hibernate-mapping>





2.
Department class having some more mapping many-to-one and some properties.

Code:
<hibernate-mapping>
    <class name="Department" table="dept_table">

        <composite-id name="id" class="deptId">
           
      <key-property name="AAA" type="string">
                <column name="aaa" length="50" />
            </key-property>
            <key-property name="BBB" type="string">
                <column name="bbb" length="50" />
            </key-property>
        </composite-id>

   <many-to-one name="Store" class="DepartmentStore" update="false" insert="false" fetch="select">
            <column name="AAA" length="50" not-null="true" />
       <column name="BBB" length="50" not-null="true" />
        </many-to-one>

        <property name="ReportId" type="java.lang.Integer">
            <column name="report_id" />
        </property>


    </class>
</hibernate-mapping>


Code:
1. List a  = createCriteria(EmpInformation.class);

2. Integer I = a.getDepartment().getReportID();


My Questions is whenever I am trying to call the ReportID on getDepartment it's giving error as org.hibernate.ObjectNotFoundException: No row with the given identifier exists:
It seems I am not getting the Department info.

This is the stmt we are using to access the Dept information :

Code:
<many-to-one name="Dept" class="Department" update="false" insert="false" fetch="select">"


I want to point some more info here
1. Lazy is true by default so whenever I access the child table entity it should get that info but it won't.
2. It's mandatory update="false" insert="false" if I remove then it's asking me to put that.


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.