Reputation: 215
When I do an executeUpdate on this SQL query in Hibernate 3.5:
Query insert = session.createSQLQuery(
"INSERT INTO unmapped_table_1 (column_name) "
+ "SELECT column_name "
+ "FROM source_table;");
insert.executeUpdate();
Hibernate returns the number of entries but does not insert the entries. When I do the query directly on the MySQL Server, the entries do get inserted.
Upvotes: 2
Views: 632
Reputation: 1812
May be your autocommit is not set to true, in this case you have to call commit()
after query execution. By default Hibernate auto commit is false you can set autocommit to true withsetAutocommit(true)
Upvotes: 1