@Test
public void testStackOverflowError() {
List<Integer> intList = new ArrayList<>();
IntStream.range(0, 200000).forEach(intList::add);
Properties properties = new Properties();
properties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
properties.put("hibernate.hbm2ddl.auto", "update");
properties.put("hibernate.show_sql", "true");
properties.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
properties.put("hibernate.connection.url", "jdbc:hsqldb:mem:test");
properties.put("hibernate.connection.username", "sa");
properties.put("hibernate.connection.password", "");
EntityManager entityManager = new Configuration().addProperties(properties).addAnnotatedClass(Qwerty.class)
.buildSessionFactory(new StandardServiceRegistryBuilder().applySettings(properties).build()).createEntityManager();
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Qwerty> query = cb.createQuery(Qwerty.class);
Root<Qwerty> root = query.from(Qwerty.class);
query.select(root).where(root.get("id").in(intList));
assertNotNull(entityManager.createQuery(query));
}