I tried to add connection.commit() at the end of the preparedStatement in createChangeRequest, without success
Setting connection.setAutoCommit(true) in the preparedStatement fails in a different way: the roRepo.get(ChangeRequestId(keyHolder.getKey().intValue)) cannot find the created entry, even if we see the database logs says
2018-12-28 17:44:27 CET [3613-223] rudder@rudder DETAIL: parameters: $1 = '494513', $2 = '2018-12-28 17:44:27.828+01', $3 = 'executionStatus'
2018-12-28 17:44:27 CET [3613-224] rudder@rudder LOG: execute S_1: COMMIT
2018-12-28 17:44:28 CET [3613-225] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-226] rudder@rudder LOG: execute <unnamed>: SELECT 1
2018-12-28 17:44:28 CET [3613-227] rudder@rudder LOG: execute S_1: COMMIT
2018-12-28 17:44:28 CET [3613-228] rudder@rudder LOG: execute <unnamed>: insert into ChangeRequest (name, description, creationTime, content, modificationId) values ($1, $2, $3, $4, $5)
RETURNING "id"
2018-12-28 17:44:28 CET [3613-229] rudder@rudder DETAIL: parameters: $1 = 'Save Group node-git-cve', $2 = '', $3 = '2018-12-28 17:44:28.814+01', $4 = '<changeRequest fileFormat="6"><groups><group id="4c395876-db0b-4cd2-b48c-a370a1e56f11"><initialState><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description></description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></initialState><firstChange><change><actor>admin</actor><date>2018-12-28T17:44:28.792+01:00</date><reason></reason><diff action="modifyTo"><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description>git cve</description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></diff></change></firstChange><nextChanges/></group></groups><directives/><rules/><globalParameters/></changeRequest>', $5 = ''
2018-12-28 17:44:28 CET [3613-230] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-231] rudder@rudder LOG: execute <unnamed>: SELECT id, name, description, creationTime, content, modificationId FROM ChangeRequest where id = $1
2018-12-28 17:44:28 CET [3613-232] rudder@rudder DETAIL: parameters: $1 = '18'
2018-12-28 17:44:28 CET [3613-233] rudder@rudder LOG: execute S_6: ROLLBACK
2018-12-28 17:44:28 CET [3613-234] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-235] rudder@rudder LOG: execute <unnamed>:
insert into eventlog (creationdate, modificationid, principal, eventtype, severity, data, reason, causeid)
values($1, $2, $3, $4,
$5, $6, $7, $8
)
RETURNING "id"
2018-12-28 17:44:28 CET [3613-236] rudder@rudder DETAIL: parameters: $1 = '2018-12-28 17:44:28.859+01', $2 = 'e7532a9c-8ad7-4af6-8c0e-b97b2a9d33f6', $3 = 'admin', $4 = 'ChangeRequestAdded', $5 = '100', $6 = '<entry><changeRequest changeType="add"><id>18</id><name>Save Group node-git-cve</name><description></description></changeRequest></entry>', $7 = '', $8 = NULL
2018-12-28 17:44:28 CET [3613-237] rudder@rudder LOG: execute S_1: COMMIT
2018-12-28 17:44:28 CET [3613-238] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-239] rudder@rudder LOG: execute <unnamed>: SELECT id, state FROM Workflow WHERE id = $1
2018-12-28 17:44:28 CET [3613-240] rudder@rudder DETAIL: parameters: $1 = '18'
2018-12-28 17:44:28 CET [3613-241] rudder@rudder LOG: execute S_6: ROLLBACK
2018-12-28 17:44:28 CET [3613-242] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-243] rudder@rudder LOG: execute <unnamed>: INSERT into Workflow (id, state) values ($1, $2)
2018-12-28 17:44:28 CET [3613-244] rudder@rudder DETAIL: parameters: $1 = '18', $2 = 'Pending validation'
2018-12-28 17:44:28 CET [3613-245] rudder@rudder LOG: execute S_6: ROLLBACK
2018-12-28 17:44:28 CET [3613-246] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-247] rudder@rudder LOG: execute <unnamed>: SELECT id, state FROM Workflow WHERE id = $1
2018-12-28 17:44:28 CET [3613-248] rudder@rudder DETAIL: parameters: $1 = '18'
2018-12-28 17:44:28 CET [3613-249] rudder@rudder LOG: execute S_6: ROLLBACK
2018-12-28 17:44:28 CET [3613-250] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:28 CET [3613-251] rudder@rudder LOG: execute <unnamed>: SELECT CR.id, name, description, creationTime, content, modificationId FROM changeRequest CR LEFT JOIN workflow W on CR.id = W.id where cast( xpath('/changeRequest/groups/group/@id', content) as text[]) = $1 and state like 'Pending%'
2018-12-28 17:44:28 CET [3613-252] rudder@rudder DETAIL: parameters: $1 = '{4c395876-db0b-4cd2-b48c-a370a1e56f11}'
2018-12-28 17:44:28 CET [3613-253] rudder@rudder LOG: execute S_6: ROLLBACK
2018-12-28 17:44:32 CET [3613-254] rudder@rudder LOG: execute S_3: BEGIN
2018-12-28 17:44:32 CET [3613-255] rudder@rudder LOG: execute <unnamed>: SELECT 1
2018-12-28 17:44:32 CET [3613-256] rudder@rudder LOG: execute S_2:
select lastid, date from statusupdate where key=$1
and in the database
id | name | description | creationtime | content | modificationid
----+-------------------------+-------------+----------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------
18 | Save Group node-git-cve | | 2018-12-28 17:44:28.814+01 | <changeRequest fileFormat="6"><groups><group id="4c395876-db0b-4cd2-b48c-a370a1e56f11"><initialState><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description></description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></initialState><firstChange><change><actor>admin</actor><date>2018-12-28T17:44:28.792+01:00</date><reason></reason><diff action="modifyTo"><nodeGroup fileFormat="6"><id>6b536c1a-4389-4aca-b5bb-156f87da37bb)</id><displayName>node-git-cve</displayName><description>git cve</description><query>{"select":"node","composition":"And","where":[]}</query><isDynamic>true</isDynamic><nodeIds/><isEnabled>true</isEnabled><isSystem>false</isSystem></nodeGroup></diff></change></firstChange><nextChanges/></group></groups><directives/><rules/><globalParameters/></changeRequest> |
(1 row)