它可能在带有HQL的表上​​插入带有嵌入式ID的行吗?

时间:2011-05-31 21:08:04

标签: hibernate hql bulkinsert

我可以使用HQL插入任何行。

示例:

insert into MyMappedTable(field,field,field) select c.x, c.y, c.z from Object c where ....

但是,我的要求是插入嵌入式标识

@JoinColumn(insertable = false, name = "CATEGORYID", referencedColumnName = "ID", updatable = false)
@ManyToOne(fetch = FetchType.EAGER, optional = false)
private Category category;

@EmbeddedId
protected CategoryProductPK categoryProductPK;

@Basic(optional = true)
@Column(name = "POSITION")
private Integer position;

@JoinColumn(insertable = false, name = "PRODUCTID", referencedColumnName = "ID", updatable = false)
@ManyToOne(fetch = FetchType.EAGER, optional = false)
private Product product;

可以使用HQL吗?

0 个答案:

没有答案