Announcement Announcement Module
Collapse
No announcement yet.
exclude-filter doesn't work Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • exclude-filter doesn't work

    Hi all,
    I've made the following Spring Data configuration:

    Code:
    <jpa:repositories base-package="com.my.dao.repositories">
    	<repository:exclude-filter type="regex" expression="com/my/dao/repositories/.*CustomRepository"/>
    </jpa:repositories>
    Then I've declared an interface MyCustomRepository:

    Code:
    public interface MyCustomRepository {
        /**
         * a customized repo method
         */
        public SortedMap<Object, Number> findCountOfMyBeansPerYear(final MyBean mb);
    The implementation of this interface is in a separate Impl class. The repository interface looks like

    Code:
    public interface MyRepository
        extends PagingAndSortingRepository<MyBean, Long>, MyCustomRepository  {
    }
    If I launch my application, Spring complaints about missing "find" property for MyBean:

    Code:
    Caused by: java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract java.util.SortedMap com.my.dao.custom.MyCustomRepository.findCountOfMyBeansPerYear(com.my.beans.Produkt)!
    	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:92)
    	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:162)
    	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:68)
    	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:280)
    	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:148)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:125)
    	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:41)
    	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    	... 37 more
    Caused by: java.lang.IllegalArgumentException: No property find found for type class com.my.beans.MyBean
    	at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:73)
    	at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:92)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:319)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:333)
    	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:301)
    	at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:265)
    	at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:239)
    	at org.springframework.data.repository.query.parser.Part.<init>(Part.java:70)
    	at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:180)
    	at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:260)
    	at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:240)
    	at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:68)
    	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:57)
    	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:90)
    I'm using Spring Data JPA 1.1.0.RELEASE with Spring 3.1.2.RELEASE. What's wrong with this configuration?

    Thanks in advance,

    Ralf.
    Last edited by rheydenr; Sep 14th, 2012, 05:49 AM.

  • #2
    I found it by myself. The reason was that I named the custom implementation class MyCustomRepositoryImpl instead of MyRepositoryImpl. Therefore Spring couldn't find the implementing class and tried to resolve a query from my method. Now at least this works. Another issue is the missing transaction, but this is another thread ;-)

    Ralf.

    Comment

    Working...
    X