Hi,
I have my lookup data (in this case EventType) set up as a read-only cache.
Everything works fine except...
I have another object, Event, that contains an EventType.
If I make a new Event, find and set the proper EventType, and then do a saveOrUpdate on it, I get the following error:
Code:
java.lang.UnsupportedOperationException: Can't write to a readonly object at org.hibernate.cache.ReadOnlyCache.lock(ReadOnlyCache.java:43) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:85)
I have cascade="none" set on the .hbm.xml, so I would think that it would not try to persist the EventType object on saveOrUpdate, but it obviously is.
I looked in the forums and was not able to find a way to fix this.
Event.hbm.xml:Code:
<hibernate-mapping package="com.evite.event.model">
<class name="Event" table="EVENTS">
<id name="id" column="EVENTID" type="string">
<generator class="assigned"/>
</id>
<property name="title" column="TITLE" type="string" />
...
<many-to-one name="eventType" lazy="proxy" class="com.evite.event.model.EventType" cascade="none" column="EVENT_TYPE" />
</class>
EventType.hbm.xml:Code:
<class name="EventType" table="EVENT_TYPES">
<cache usage="read-only"/>
<id name="eventType" column="EVENT_TYPE" type="string">
<generator class="assigned"/>
</id>
<property name="displayName" column="DISPNAME" type="string" />
</class>
I am just hoping that there is a way to prevent hibernate from doing the update to EventType.
Sorry if I missed relevant posts on the subject.
Thank you,
Jeff