- * EntityManager em = ... // Obtain EntityManager - * - * UserRepositoryCustom custom = new UserRepositoryImpl(); - * custom.setEntityManager(em); - * - * RepositoryFactorySupport factory = new JpaRepositoryFactory(em); - * UserRepository repository = factory.getRepository(UserRepository.class, custom); - *- * - * Using the Spring namespace the implementation will just get picked up due to - * the classpath scanning for implementations with the {@code Impl} postfix. - * - *
- * <jpa:repositories base-package="com.acme.repository" /> - *- * - * If you need to manually configure the custom instance see - * {@link UserRepositoryJdbcImpl} for an example. - * - * @author Oliver Gierke - */ -class UserRepositoryImpl implements UserRepositoryCustom { - - @PersistenceContext - private EntityManager em; - - - /** - * Configure the entity manager to be used. - * - * @param em the {@link EntityManager} to set. - */ - public void setEntityManager(EntityManager em) { - - this.em = em; - } - - - /* - * (non-Javadoc) - * - * @see org.springframework.data.jpa.sample.repository.UserRepositoryCustom# - * myCustomBatchOperation() - */ - public List
- * As you need to hand the instance a {@link javax.sql.DataSource} or - * {@link org.springframework.jdbc.core.simple.SimpleJdbcTemplate} you manually - * need to declare it as Spring bean: - * - *
- * <jpa:repository base-package="com.acme.repository" /> - * - * <bean id="userRepositoryImpl" class="...UserRepositoryJdbcImpl"> - * <property name="dataSource" ref="dataSource" /> - * </bean> - *- * - * Using {@code userRepositoryImpl} will cause the repository instance get this - * bean injected for custom repository logic as the default postfix for custom - * DAO instances is {@code Impl}. - * - * @author Oliver Gierke - */ -class UserRepositoryJdbcImpl extends JdbcDaoSupport implements -UserRepositoryCustom { - - private static final String COMPLICATED_SQL = "SELECT * FROM User"; - - - /* - * (non-Javadoc) - * - * @see org.springframework.data.jpa.sample.repository.UserRepositoryCustom# - * myCustomBatchOperation() - */ - public List
+ * TODO: change back to {@code AuditorAware