Hello,
I am currently migrating from openjpa 4.1.X to 4.2.X and I noticed that
significant changes to stored procedure transactions were made.
However, there is at least one thing where I believe the behavior makes no
sense.
My old code which worked in 4.1.X was this:
transaction.begin();
StoredProcedureQuery proc =
em.createStoredProcedureQuery("delete_marked_files");
proc.execute();
orphansWiped = ((Number) proc.getOutputParameterValue(1)).longValue();
transaction.commit();
The code required to achieve the same result in 4.2.0 is this:
transaction.begin();
OpenJPAPersistence.cast(em).beginStore();
StoredProcedureQuery proc =
em.createStoredProcedureQuery("delete_marked_files");
proc.registerStoredProcedureParameter(1, Long.class, ParameterMode.OUT);
proc.execute();
orphansWiped = ((Number) proc.getOutputParameterValue(1)).longValue();
transaction.commit();
"em" is the EntityManager and "transaction" is the return value of
em.getTransaction()
The procedure is running on a Postgres DB and pretty much just deletes a bunch
of rows in a few tables and has one BIGINT out parameter.
If I do not do "OpenJPAPersistence.cast(em).beginStore();" then the transaction
gets rolled back, meaning that the rows are still there.
I also verified that this is not a caching error of some sorts, the transaction
doesnt get commited unless I explicitly call the openjpa specific beginStore
function.
I dont think this is quite the intended behavior.
Sidenote: I would really like to have access to your jira to make such bug
reports, but last time I attempted to sign up, I simply got no reply.
Alexander Schütz
Software-Entwickler
[Photo]<https://www.imagic.ch/?utm_source=email&utm_campaign=signature>
Office
+41 44 809 40 60
Email
[email protected]<mailto:[email protected]>
Imagic Bildverarbeitung AG
Sägereistrasse 29, CH-8152
Glattbrugg<https://maps.google.com/?q=S%C3%A4gereistrasse%2029,%20CH-8152%20Glattbrugg>
www.imagic.ch<https://www.imagic.ch/?utm_source=email&utm_campaign=signature>
[Linkedin Icon]<https://www.linkedin.com/company/imagic-ch>
[__tpx__]