Hello,
following example tries to update more than 10000 entities by an update query.
But only the first 10000 elements are updated.
What's wrong?
public class updateMoreThan10000Elements { static int idCounter = 1; public static void main(String[] args) { EntityManagerFactory emf; emf = Persistence.createEntityManagerFactory("objectdb:./db.tmp;drop"); EntityManager emOne = emf.createEntityManager(); emOne.getTransaction().begin(); emOne.setFlushMode(FlushModeType.AUTO); { create10001Elements(emOne); } emOne.getTransaction().commit(); emOne.close(); EntityManager emTwo = emf.createEntityManager(); emTwo.getTransaction().begin(); emTwo.setFlushMode(FlushModeType.AUTO); { String query = "UPDATE " + MyModelElement.class.getName() + " c " + "SET c.visible = true"; Query q = emTwo.createQuery(query); q.executeUpdate(); } emTwo.getTransaction().commit(); emTwo.close(); EntityManager emThree = emf.createEntityManager(); emThree.getTransaction().begin(); emThree.setFlushMode(FlushModeType.AUTO); { assertTrue(emThree.find(MyModelElement.class, 10000).isVisible()); assertTrue(emThree.find(MyModelElement.class, 10001).isVisible()); } emTwo.getTransaction().commit(); emTwo.close(); emf.close(); System.out.println("All done."); } /** * Brief Function description * * @param emOne * */ private static void create10001Elements(EntityManager emOne) { for (int i = 1; i < 10002; i++) { emOne.persist(new MyModelElement()); } } @Access (AccessType.FIELD) @Entity public static class MyModelElement { @Id int id; @Version long version; @Basic boolean visible = false; /** Constructor */ public MyModelElement() { id = idCounter++; } public int getId() { return this.id; } public boolean isVisible() { return this.visible; } } }