Class SQLMapper


  • public class SQLMapper
    extends java.lang.Object
    SQL Mapper
    • Constructor Summary

      Constructors 
      Constructor Description
      SQLMapper​(java.io.File configFile)  
      SQLMapper​(java.lang.String jndiName)
      Create an SQL Mapper on top of JNDI connection.
      SQLMapper​(java.sql.Connection connection)
      Create an SQL Mapper out of the already opened connection.
      SQLMapper​(java.util.Properties config)
      Create an SQL Mapper from the properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.sql.ResultSet call​(java.lang.String querypath, java.util.Map<?,​?> params)
      Call SQL query.
      void close()
      Close connection to the database.
      void close​(java.sql.ResultSet result)
      Close connection to the database and result.
      SQLMapper connect​(java.lang.String tag)
      Connect to the database using a tag.
      void setDebug​(boolean debug)  
      SQLMapper setInitCallback​(ConnectionCallback callback)  
      SQLMapper setResourceClass​(java.lang.Class cls)
      Set resources class.
      void setStderrVerbose​(boolean stderrVerbose)
      Set STDERR verbose.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SQLMapper

        public SQLMapper​(java.util.Properties config)
                  throws java.sql.SQLException
        Create an SQL Mapper from the properties.
        Parameters:
        config -
        Throws:
        java.sql.SQLException
      • SQLMapper

        public SQLMapper​(java.sql.Connection connection)
                  throws java.sql.SQLException
        Create an SQL Mapper out of the already opened connection.
        Parameters:
        connection -
        Throws:
        java.sql.SQLException
      • SQLMapper

        public SQLMapper​(java.lang.String jndiName)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
        Create an SQL Mapper on top of JNDI connection.
        Parameters:
        jndiName -
        Throws:
        java.sql.SQLException
        javax.naming.NamingException
      • SQLMapper

        public SQLMapper​(java.io.File configFile)
                  throws java.io.FileNotFoundException,
                         java.io.IOException,
                         java.sql.SQLException
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        java.sql.SQLException
    • Method Detail

      • setStderrVerbose

        public void setStderrVerbose​(boolean stderrVerbose)
        Set STDERR verbose.
        Parameters:
        stderrVerbose -
      • setDebug

        public void setDebug​(boolean debug)
      • connect

        public SQLMapper connect​(java.lang.String tag)
                          throws java.net.URISyntaxException,
                                 java.lang.ClassNotFoundException,
                                 java.lang.Exception
        Connect to the database using a tag.
        Parameters:
        tag -
        Throws:
        java.net.URISyntaxException
        java.lang.ClassNotFoundException
        java.lang.Exception
      • call

        public java.sql.ResultSet call​(java.lang.String querypath,
                                       java.util.Map<?,​?> params)
                                throws java.sql.SQLIntegrityConstraintViolationException,
                                       java.sql.SQLException,
                                       java.lang.Exception
        Call SQL query. ResultSet will be set to null in case it is not a SELECT statement.
        Parameters:
        querypath -
        params -
        Returns:
        Throws:
        java.sql.SQLIntegrityConstraintViolationException
        java.sql.SQLException
        java.lang.Exception
      • close

        public void close​(java.sql.ResultSet result)
        Close connection to the database and result.
      • close

        public void close()
        Close connection to the database.
      • setResourceClass

        public SQLMapper setResourceClass​(java.lang.Class cls)
        Set resources class.
        Parameters:
        cls -
        Returns: