-->
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: Retrieve Object from 1st Level Cache without Primay Key
PostPosted: Thu Jul 17, 2008 6:08 pm 
Newbie

Joined: Thu Jul 17, 2008 5:51 pm
Posts: 1
I have a Hibernate mapped class that has a unique business key property.

I realize that session.Load(typeof(MyClass), myClassId) will first look in the first level cache, but I would like to retrieve one of these objects from 1st level cache with the business key? Is this possible?

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="my.class.MyClass, my.namespace" table="mytable" lazy="false">
<cache usage="read-write" region="myregion"/>
<id name="myid" type="long" unsaved-value="null">
<column name="myid" not-null="true" />
<generator class="native" />
</id>
<property name="BusinessKey" unique="true" index="IX_N_BusinessKey_1" type="String">
<column name="BusinessKey" length="50" not-null="true"/>
</property>
.
.
.
.

</class>
</hibernate-mapping>

If this is not possible, any other suggestions? One idea is to maintain a different cache that has business-key to id mappings.

Thoughts?


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.