0

Is there any way if executing batch updates (EntityManager persist() or merge()) using JPA Toplink?

jagbandhuster
  • 677
  • 2
  • 7
  • 20

1 Answers1

2

If you want to do a batch update, you can create a Query (either JPQL or Native SQL) that performs the update using the EntityManager, and then call executeUpdate on that query.

Terrell Plotzki
  • 2,014
  • 17
  • 17
  • If I use JPQL (using XML file), I usually get an error about the fields unitialized or unknown (some error like that). How can I cope up with such error? I wish to avoid using query in code, as I may need to change the code often then. – jagbandhuster Sep 10 '11 at 03:39
  • Can you post the query, the error, and the associated entities? – Terrell Plotzki Sep 11 '11 at 00:16