我有缓存使用问题,我有以下映射。无论出于何种原因,ST_CD 两次映射到 2 个不同的属性。休眠正在抛出
org.hibernate.MappingException: Repeated column in mapping for entity: my.package.State column: ST_CD (should be mapped with insert="false" update="false")
我将缓存使用为“只读”,所以我猜插入和更新总是错误的;为什么我要明确地说 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>