-->
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.  [ 2 posts ] 
Author Message
 Post subject: Get problem with an undefined id
PostPosted: Wed May 11, 2005 10:32 am 
Newbie

Joined: Wed May 05, 2004 1:00 pm
Posts: 7
Hi,

I'm having a problem with loading an object from the database with an undefined id value. The row is in the table but when I do a get () with the id, I receive a null. My guess is this is because of the undefined value for the id. I can't use a version identifier because the object is first created from SAP without a version and I use the same id as SAP to save it to another db.

Any solution or workaround to this problem? Or some part of the reference I should read again...



Hibernate version:
3.02

Mapping documents:
Code:
<hibernate-mapping package="cz.vsb.phonebook.model.pasport">
   <class name="Areal" table="Areal" select-before-update="true" lazy="false">
      <id name="id" type="long" column="areal_id" unsaved-value="undefined">
      </id>
      <property name="name" column="name"/>
      <many-to-one name="address" column="address_id" not-null="true"/>
   </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
s.get (Areal.class, new Long (areal.getId ());


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 12:48 pm 
Newbie

Joined: Wed May 05, 2004 1:00 pm
Posts: 7
However, I can get the object with an hql query.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.