Its possible insert row with embedded ID on table with HQL?

点点圈 提交于 2019-12-10 17:22:54

问题


I'm able to insert any row with HQL.

Example:

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

But, my requirement is insert with embedded Id

@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;

Is possible with HQL?

来源:https://stackoverflow.com/questions/6193573/its-possible-insert-row-with-embedded-id-on-table-with-hql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!