java - How to INSERT using a SELECT in Hibernate -
i need implement following request in hibernate:
insert my_table(....,max_column) values(...,(select max(id) special_table ....))
how in hibernate, using annotations? special_table may not child or dependency of my_table, subselect.
you can use hql insert syntax:
string hqlinsert = "insert myentity(....,max_column) select ..., max(id) specialentity ...."; int updatecount = session.createquery(hqlinsert).executeupdate();
Comments
Post a Comment