Hibernate

这是hibernate的一个bug,具体看https://hibernate.atlassian.net/browse/HHH-11732?attachmentViewMode=list

When using stateless session with jdbc batch size we get an

HHH000352: Unable to release batch statement..

error in session.close() after rollback:

Code:
Configuration cfg = new Configuration();
cfg.setProperty(Environment.STATEMENT_BATCH_SIZE, "10");
factory = cfg.configure().buildSessionFactory();

StatelessSession session = factory.openStatelessSession();
Transaction tx = session.beginTransaction();

Employee employee = new Employee("1", "2", 1);
employee.setId(id++);
session.insert(employee);

tx.rollback();

session.close();

In rollback the statements are closed but still remain in the jdbc batch,
which is trying to close them a second time on session.close().

5.2.11.Final版本已经修复了这个问题

原文地址:https://www.cnblogs.com/firejava/p/7562464.html