Spring Data Commons
  1. Spring Data Commons
  2. DATACMNS-154

Overwriting of delete(T entity) saveAndFlush(T entity); does not work anymore

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3 RC1
    • Fix Version/s: 1.3 RC2
    • Component/s: Core
    • Labels:
      None

      Description

      During initialization of the following repository an exception occurs for these two methods.

      public interface UserRepository extends JpaRepository<User, Long>,
      		PagingAndSortingRepository<User, Long> {
      
      	public User saveAndFlush(User entity);
      
      	public void delete(User entity);
      }
      
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract entities.User repositories.UserRepository.saveAndFlush(entities.User)!
              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
              at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442)
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248)
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:848)
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790)
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
              at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
              ... 41 more
      Caused by: java.lang.IllegalArgumentException: Could not create query metamodel for method public abstract entities.User repositories.UserRepository.saveAndFlush(entities.User)!
              at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:95)
              at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:164)
              at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:71)
              at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:269)
              at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:142)
              at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:114)
              at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:38)
              at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
              ... 49 more
      Caused by: java.lang.IllegalArgumentException: No property save found for type class entities.User
              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: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:93)
              ... 56 more
      
      

      The same code works with snapshot before weekend (13.04.2012).
      So

        Issue Links

          Activity

          Hide
          Oliver Gierke added a comment -

          Would you mind upgrading SD Commons to the latest build snapshot? This should fix the issue then.

          Show
          Oliver Gierke added a comment - Would you mind upgrading SD Commons to the latest build snapshot? This should fix the issue then.
          Hide
          Thomas Hackel added a comment -

          Works with:
          spring-data-commons-core-1.3.0.BUILD-20120419.105004-31.jar

          Thanks

          Show
          Thomas Hackel added a comment - Works with: spring-data-commons-core-1.3.0.BUILD-20120419.105004-31.jar Thanks

            People

            • Assignee:
              Oliver Gierke
              Reporter:
              Thomas Hackel
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: