public void prepareTables() throws Exception
    {
        Path ddlPath = Paths.get(ClassLoader.getSystemResource("sql").toURI());

        try (Connection conn = xaConnectionManager.getConnection();)
        {
            Files.walk(ddlPath, 1)
                    .filter(path -> !Files.isDirectory(path)
                            && (path.toString().endsWith("ddl")
                            || path.toString().endsWith("idx")))
                    .forEach(path -> {
                try
                {
                    RunScript.execute(conn, Files.newBufferedReader(path));
                }
                catch (Exception e)
                {
                    throw new RuntimeException("Exception at table initialization", e);
                }
            });
        }
    }
public void prepareTables ( ) throws Exception { Path ddlPath = Paths . get ( ClassLoader . getSystemResource ( "sql" ) . toURI ( ) ) ; try ( Connection conn = xaConnectionManager . getConnection ( ) ; ) { Files . walk ( ddlPath , 1 ) . filter ( path -> ! Files . isDirectory ( path ) && ( path . toString ( ) . endsWith ( "ddl" ) || path . toString ( ) . endsWith ( "idx" ) ) ) . forEach ( path -> { try { RunScript . execute ( conn , Files . newBufferedReader ( path ) ) ; } catch ( Exception e ) { throw new RuntimeException ( "Exception at table initialization" , e ) ; } } ) ; } }
This is not typically done in production app.