In my first attempt I created a Singleton which is executed on startup.
Why a Singleton?
I read the statements of the script line for line and execute the native query with "em.createNativeQuery()". The problem is that a statement of the patchscript has mostly more than one line ;). Is there a better way to execute the statements of the patch script without parsing its content?
Could you not just read the whole file and run it via
JDBC?