Skip to content

Instantly share code, notes, and snippets.

View nerg4l's full-sized avatar

László GÖRÖG nerg4l

View GitHub Profile
@nerg4l
nerg4l / MyRepositoryImpl.java
Last active January 3, 2019 08:25 — forked from jelies/MyRepositoryImpl.java
A Spring FactoryBean to create a Hibernate's StatelessSession to be injected in your custom repository implementation when using Spring Data JPA.
package com.jelies.spring3tomcat7.repository;
import org.hibernate.Criteria;
import org.hibernate.ScrollableResults;
import org.hibernate.StatelessSession;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;