我有一个如下所示的实体,注释@SecondaryTable 映射了两个表。两个表的 PrimaryKey 的名称都是'resource_id'。当我执行 HQL
delete AssetProjectProposalInfoEntity e where e.resourceId=:rid
出现列不明确定义的错误。
import ...
@Entity
@Table(name = "ASSET_PROJECT_INFO", schema = "CORE_WAC")
@SecondaryTable(name="ASSET_PROJECT_PROPOSAL_INFO", schema="CORE_WAC")
public class AssetProjectProposalInfoEntity
{
@Id
@Column(name = "RESOURCE_ID")
@GeneratedValue(generator="UUIdentifier")
@GenericGenerator(name="UUIdentifier", strategy = "uuid")
private String resourceId;
@Column(name = "PROJECT_NAME")
private String projectName;
@Column(table="ASSET_PROJECT_PROPOSAL_INFO", name="PROJECT_TYPE")
private String projectType;
@Column(table="ASSET_PROJECT_PROPOSAL_INFO", name="APPLY_UNIT_ID")
private String applyUnitId;
...
}
控制台日志如下。显示SQL中的where子句是RESOURCE_ID=? ,但应该是assetproje0_.RESOURCE_ID=? 我认为。任何身体都可以帮忙吗?谢谢:)
Hibernate: insert into HT_ASSET_PROJECT_INFO select assetproje0_.RESOURCE_ID as
RESOURCE_ID from CORE_WAC.ASSET_PROJECT_INFO assetproje0_ left outer join
CORE_WAC.ASSET_PROJECT_PROPOSAL_INFO assetproje0_1_ on
assetproje0_.RESOURCE_ID=assetproje0_1_.RESOURCE_ID where RESOURCE_ID=?
Hibernate: delete from HT_ASSET_PROJECT_INFO