| Summary: | flush() doesn't flush native queries if batch writing is enabled | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Patric Rufflar <patric> | ||||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P2 | CC: | christopher.delahunt, tom.ware, vicki.shimizu | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Patric Rufflar
Response on mailing list from James Sutherland: It seems the batch is not being flushed because there were no changes, the native query was thought to have already been executed. Please log a bug for this, the batch should always get flushed on flush, even with no changes. It is also odd that the native query is batched at all. This seems to be our default when batching, but can be set on the ModifyQuery using setForceBatchStatementExecution(true). There does not seem to be a query hint for this though, so please add this to the bug. See bug 266151. I need a way to get the correct number of rows processed from Query.executeUpdate(). I would either like a way to turn off batch writing for the session or for the statement, so that I can get the actual number of rows processed. If flush() is changed to execute the batched statement, it would give me a way to execute the batch immediately, however, I still wouldn't be able to get the count of rows processed. Created attachment 180808 [details] proposed fix uploaded patch corrects the flush to also flush the BatchWritingMechanism. bug 266151 (allowing executeUpdate to return an accurate row count when batch writing is used) will require new api to allow update statements to be included or excluded from batches, and likely make this fix unneccessary. Please vote for it to have its priority adjusted. Created attachment 181128 [details]
proposed fix and test caes
Fix checked into 2.2 revision 8372 -RepeatableWriteUnitOfWork now calls writesCompleted() on flush even when no changes in the changeset have been detected. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |