I'm running an integration test that executes some Hibernate code within a single transaction (managed by Spring). The test is failing with a duplicate key violation and I'd like to hit a breakpoint just before this and inspect the table contents. I can't just go into MySQL Workbench and run a
The following can be run from Eclipse's "Display" view:
java.util.Arrays.deepToString( em.createNativeQuery("SELECT mystuff FROM mytable").getResultList().toArray()) .replace("], ", "]\n");
This displays all the data, albeit not in a very user-friendly way - e.g. will need to work out which columns the comma-separated fields correspond to.