I have cache usage question, I have the following mapping. ST_CD is mapped twice to 2 different properties for whatever reason. Hibernate is throwing
org.hibernate.MappingException: Repeated column in mapping for entity: my.package.State column: ST_CD (should be mapped with insert="false" update="false")
I have cache usage as “read-only”, so i guess insert and updates are always false; why should I explicitly say insert=”false” update=”false”?
<class mutable="false" name="my.package.State" table="STATE_TABLE">
<cache usage="read-only" />
<id name="id" column="ST_ID" type="long" />
<property name="code" type="string" column="ST_CD" />
<property name="stateAbbreviationCode" type="string" column="ST_CD"/>
<!- Other properites -->
</class>
When you create an Entity in hibernate, it should be ready to use an a normal bean. Whether you cache or not it is not possible to update the database thru multiple properties. So you need to use the ‘ insert=”false” update=”false”` on one of the properties.