
Originally Posted by
Oliver Gierke
I think you stumble over the fact that we lookup the implementation interface and class in the very same package of the original repository interface. If you place all into one you should be fine. A second approach should be naming the implementaion bean accountDaoImpl as we check for an existing bean matching the "repository name + postfix" pattern before registering a bean definition for a potentially found class. This should enable you to get rid of the manual repository configuration.
I believe I have followed the first approach to the letter and read the reference document (see link bellow) over and over, but I still get the same error as vguna.
http://static.springsource.org/sprin...tory-behaviour
I have the following files all in the same folder:
RepresentativeRepository
Code:
public interface RepresentativeRepository extends JpaRepository<Representative, Integer>, RepresentativeRepositoryCustom {
@Override
List<Representative> doStuff();
}
RepresentativeRepositoryCustom
Code:
public interface RepresentativeRepositoryCustom {
List<Representative> doStuff();
}
RepresentativeRepositoryImpl
Code:
public class RepresentativeRepositoryImpl implements RepresentativeRepositoryCustom {
@PersistenceContext
private EntityManager entityManager;
@Override
public List<Representative> doStuff() {
Query query = entityManager.createQuery("my query...");
return query.getResultList();
}
}