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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -