-->
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: Mapping data to be cached but not persisted
PostPosted: Thu Sep 21, 2006 4:01 am 
Newbie

Joined: Thu Sep 21, 2006 3:42 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5
Name and version of the database you are using:DB2 8


Hello,

I want to associate clases to hibernate entities as properties , or associations that i dont want to be persistent but i want to be cached by second level cache.
I want to do that to no recalculate data, and to atatch external data to entities and continue operating like hibernate entities.

I have seen some posts indicating the use of UserType or CompositeUserType for that task.
The problem is that i don't know exactly what to do to make possible that hibernate don't try to select the property with the usertype when i try to load of find the entity.

I am trying to do something like that:

<hibernate-mapping>

<class dynamic-update="true" table="PERSISTED_TABLE" name="com.xxx.yyy.Entity" schema="TABLES">

<cache usage="read-write"></cache>

<id column="CODE" name="code">
<generator class="assigned"/>
</id>
<property name="description" column="DESCRIPCION/>

<property name="table"
lazy="true"
insert="false"
update="false"
type="com.xxx.yyyy.TableUserType"/>
</class>
</hibernate-mapping>


With that i can persist the object without trying to persist the object name "table" , but when i try to select the mapped entity, fails in the select because includes the column "table" that doesn't exists in database.
Is posible to tweak the mapping to put a property like selectable="false" or somithing similar?

Some advice to be possible to acomplish the objective?
It is posible to map a property to cache the data but not persist it in database? If so, how can it be? Another method to do that?

Apologises for my terrible english.
Thank you very much for patience and possible responses.
Kind regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 21, 2006 10:50 am 
Newbie

Joined: Thu Sep 21, 2006 3:42 am
Posts: 3
Hello,

I have succed in not select the column, using a formula that search for an existing column (identifier) but, the data is not cached by second level cache.

Someone with any idea?

Thank you.


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.