开发者

Insert Row Into Composite Table With Hibernate Named Query

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜