![](/img/trans.png)
[英]hibernate jpa with java configuration using spring instead of xml
[英]How to @AttributeOverride of column names using xml configuration instead of JPA Anotations
我想使用xml在子類中覆蓋列名。 我知道可以使用@AttributeOverride JPA注釋完成此操作,但想使用XML配置實現相同的目的嗎?
您可以使用Embedded和attribute-override元素。
請參見第3章。通過XML / 3.1.3覆蓋元數據。 屬性級別元數據 。
本文檔中的一個示例:
<attributes>
<id name="id">
<column name="fld_id"/>
<generated-value generator="generator" strategy="SEQUENCE"/>
<temporal>DATE</temporal>
<sequence-generator name="generator" sequence-name="seq"/>
</id>
<version name="version"/>
<embedded name="embeddedObject">
<attribute-override name"subproperty">
<column name="my_column"/>
</attribute-override>
</embedded>
<basic name="status" optional="false">
<enumerated>STRING</enumerated>
</basic>
<basic name="serial" optional="true">
<column name="serialbytes"/>
<lob/>
</basic>
<basic name="terminusTime" fetch="LAZY">
<temporal>TIMESTAMP</temporal>
</basic>
</attributes>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.