Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bakir Farooq   on Jul 24 In Java Category.

  
Question Answered By: Jezza Brown   on Jul 24

you must use executeUpdate instead of execute  or excecuteQuery as following code:


Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();

String hqlInsert = "insert into DelinquentAccount (id, name) select c.id, c.name from Customer c where ...";
int createdEntities = s.createQuery( hqlInsert )
.executeUpdate();
tx.commit();
session.close();

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Bulk Delete Or get search suggestion and latest updates.


Tagged: