My project uses hibernate-core 3.3.1.GA,
As you can see I'm dealing with legacy code.
Which Hibernate release introduced batch inserts where by the convention is
multiple rows specified for a single insert into statement?
ie. this example from Vlad's book.
“Query: ["INSERT INTO post (title, id) VALUES (?, ?)"],
Params: [('Post no. 1', 1), ('Post no. 2', 2), ('Post no. 3', 3)]”
as opposed to
“INSERT INTO post (title, id) VALUES ('Post no. 1', 1)”
“INSERT INTO post (title, id) VALUES ('Post no. 2', 2)”
“INSERT INTO post (title, id) VALUES ('Post no. 3', 3) ”
also I have some batching where I put something in a collection and I either periodically flush
the collection by persisting all it's elements and then committing or explicitly persist it when the batch size is reached. Because the timer uses a scheduled executor this involves a synchronized block around the collection
which isn't optimal but ensures exclusivity when operating on the batch.
If a batch doesn't process what are the options to allow it to call persist on the same objects again?
1. always process a batch so I must clear my collection if I've previously persist? so I'm expected
to always handle the batch whether successful or not?
Otherwise next time it tries to process the collection I end up processing a detached object.
What alternatives to this are there?