开发者

Insert Row Into Composite Table With Hibernate Named Query

开发者 https://www.devze.com 2023-02-14 01:02 出处:网络
Does anyone know the correct syntax in HQL to insert a row into a composite table? or an example somehwere else?Nothing online, man I miss Linq-To-Sql.

Does anyone know the correct syntax in HQL to insert a row into a composite table? or an example somehwere else? Nothing online, man I miss Linq-To-Sql.

@NamedQueries({
@NamedQuery( name = "WebsiteAction.addActionWeb开发者_如何转开发site", query = "INSERT INTO WebsiteAction 
(websiteActionPK, websiteActionPK) SELECT a.Id, w.Id FROM Action a, Website w WHERE a.Id = :actionid AND w.Id = :websiteid")
})


The syntax for bulk insertstatements is described here. But this will only work if you try to insert into a table mapped to en entity. If WebsiteAction is just a join table, I think you'll have to use SQL rather than HQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号