Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



InterceptNate is a Hibernate session and transaction manager that doesn't use any third party library (e.g., Spring Transaction Management). InterceptNate promises over 50% reduction in the size of the DAOs used in a Hibernate-powered application.


Hibernate session and transaction management is traditionally done as follows:

Session session = TraditionalInterceptor.getSessionFactory().openSession();
Transaction transaction = null;
try {
    transaction = session.beginTransaction();
    // session.get,, session.delete, session.update,
    // session.createQuery.list() or session.createSQLQuery.list()
} catch (HibernateException e) {
    if (transaction != null)
} finally {

With InterceptNate, it's sufficient to only write this:

return CallbackInterceptor.inTransaction(new TransactionCallback() {
    public T doInTransaction() {
        // return session.get,, session.delete, session.update,
        // session.createQuery.list() or session.createSQLQuery.list()


InterceptNate uses the following software components:

  1. JDK 1.8.0

  2. Hibernate 4.3.9

  3. HSQLDB 2.3.2 (for InterceptNateSample)


Refer to the InterceptNateSample application.


InterceptNate isn't hosted on Maven Central Repository. To use InterceptNate in your project, you need to install InterceptNate-0.1.jar into your local Maven repository using the command:

mvn install:install-file -Dfile=InterceptNate-0.1.jar -Dpackaging=jar -DgroupId=info.sarihh -DartifactId=InterceptNate-0.1 -Dversion=0.1

And then insert the following dependecny in your POM:



Post your questions to InterceptNate mailing list.


Copyright © 2013 Sari Haj Hussein.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Code Disclaimer

The author of this software code has used his best efforts in preparing the code. These efforts include the development, research, testing, and optimization of the theories and programs to determine their effectiveness. This software code is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility. Author disclaims any express or implied warranty of fitness for such uses. The author makes no warranty of any kind, expressed or implied, with regard to this software code or to the documentation accompanying it. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption whatsoever) arising out of, the furnishing, performance, or use of this software code, even if advised of the possibilities of such damages.

Something went wrong with that request. Please try again.