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.