I have an Entity shown as below, there are two tables mapped by annotation @SecondaryTable. The PrimaryKey's names of two tables are both 'resource_id'. When I execute HQL
delete AssetProjectProposalInfoEntity e where e.resourceId=:rid
Column ambiguously defined error occured.
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;
...
}
The console log as below.It shows that the where clause in the SQL is RESOURCE_ID=? , but it should be assetproje0_.RESOURCE_ID=? I think. Can any body help? Thanks:)
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