Class DatabaseService

    • Constructor Detail

      • DatabaseService

        public DatabaseService​(org.slf4j.Logger logger,
                               String driver,
                               String url,
                               String user,
                               String password,
                               int minIdle,
                               int maxIdle,
                               int maxTotal,
                               int maxOpenPreparedStatements,
                               int isolationLevel,
                               boolean applyNativeSql)
        Instantiates a new DatabaseService.
        Parameters:
        logger - the logger instance
        driver - the database driver
        url - the URL to the endpoint of the database
        user - the name of the database user
        password - the password of the database user
        minIdle - the minimum number of idle connections used for connection pooling
        maxIdle - the maximum number of idle connections used for connection pooling
        maxTotal - the maximum number of total connections used for connection pooling
        maxOpenPreparedStatements - the maximum number of open prepared statements
        isolationLevel - the isolation level used for transactions
        applyNativeSql - the flag to enable or disable native SQL for batch processing
    • Method Detail

      • startup

        public void startup()
        Startup method.
      • shutdown

        public void shutdown()
        Shutdown method.
      • hasUpdatedSchema

        public boolean hasUpdatedSchema()
        Check if the schema was updated.
        Returns:
        the boolean
      • withTransaction

        public <T> T withTransaction​(Function<QueryDefFactory,​T> block)
        Description copied from interface: Transactional
        Creates a transaction for the lifetime of a code block.
        Specified by:
        withTransaction in interface Transactional
        Parameters:
        block - the code block
        Returns:
        the return value of the code block