java - 没有使用 EcpliseLInk 2.6.7 选择正确的映射
问题描述
我已经使用 EclipseLink jar 2.6.7 创建了一个员工 hbm 文件,如果它返回 Regular_EMP 对象,那么它正在选择父类对象(包含 t)以在 Employee 表中插入数据,但是如果我使用 EclipseLink jar 2.6.5 和 Regular_EMP 对象它正在选择正确的子类 Regular_EMP 对象并在员工表中正确插入日期。为什么这是 EclipseLink jar2.6.7 的奇怪行为
<?xml version="1.0"?>
<entity-mappings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm
http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_1.xsd"
version="2.1">
<access>PROPERTY</access>
<entity class="Employee">
<table name="EMP" />
<discriminator-column name="C_TYPE"
discriminator-type="STRING" />
<sequence-generator sequence-name="SEQ_EMP"
name="gen_securisation" allocation-size="1">
</sequence-generator>
<attributes>
<id name="objId" access="FIELD">
<column name="N__ID" />
<generated-value strategy="SEQUENCE" generator="gen_emp" />
</id>
<basic name="level">
<column name="N_LEVEL" />
</basic>
</attributes>
</entity>
<entity exclude-default-mappings="true"
class="Regular_EMP">
<table name="EMP" />
<inheritance strategy="SINGLE_TABLE" />
<discriminator-value>3</discriminator-value>
<attributes>
<basic name="SPI">
<column name="B_SPI" />
</attributes>
</entity>
而Regular_EMP 是emp 的子类。
解决方案
推荐阅读
- continuous-integration - GoCD : 获取触发管道的材质名称
- php - JSON对象到数组的转换
- c# - AAD B2C 获取可选的自定义属性
- ffmpeg - FFmpeg:concat 协议提供损坏的输出并跳过几帧
- qt - QT setInputMask():如何在 QLineEdit 中使用用户输入插入字符串
- xml - 使用 xslt 聚合
- c# - 列表结果的开闭原则
- laravel - 设置属性和除列的 laravel 质量分配
- java - 如何从在线 JSON [url.json] 读取数据并将其值分配给 java 变量
- python - OpenCV2 - 实例化 VideoWriter 对象时抑制压缩对话框