This is similar to issue #436, where PostgreSQLOidDataType.getSqlValue would cast connections to PGConnection directly.
This issue was not fixed in the setSqlValue method, which results in ClassCastExceptions when inserting large objects with a wrapped/proxied connection (e.g. HikariCP).
Example test: https://github.com/kmolski/dbunit-issue-446/blob/main/src/test/java/pl/kmolski/DbunitProxyReproTest.java
The issue could be solved like bug #436, by changing the cast:
LargeObjectManager lobj = ((org.postgresql.PGConnection)
statement.getConnection()).getLargeObjectAPI();
to unwrap:
PGConnection pgConnection = connection.unwrap(PGConnection.class);
LargeObjectManager lobj = pgConnection.getLargeObjectAPI();
Thank you for reporting with a solution; even better you made a test - very helpful! Thank you very much. Will review and apply this as soon as I can.
This ticket can be closed, it was fixed by https://sourceforge.net/p/dbunit/code.git/merge-requests/58/