Announcement Announcement Module
Collapse
No announcement yet.
Invalid derived query! No property delete found for type java.lang.Object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invalid derived query! No property delete found for type java.lang.Object

    Hi,

    I'm using STS 3.2.0-RELEASE on a Java Spring Data JPA Maven project.

    The Maven build is successful.

    But I can see an error in the STS code pane that reads: Invalid derived query! No property delete found for type java.lang.Object

    Here is the code:

    Code:
    @NoRepositoryBean
    public interface GenericRepository<T, ID extends Serializable> extends JpaRepository<T, ID> {
    
    	public T deleteById(ID id) throws NotFoundException;
    	
    }
    
    @Repository
    @Transactional
    public class GenericRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements GenericRepository<T, ID> {
    
    	private static Logger logger = LoggerFactory.getLogger(GenericRepositoryImpl.class);
    
    	public GenericRepositoryImpl(JpaEntityInformation<T, ID> entityMetadata, EntityManager entityManager) {
    		super(entityMetadata, entityManager);
    	}
    	
    	@Override
    	@Transactional(propagation = Propagation.REQUIRED)
    	public T deleteById(ID id) throws NotFoundException {
    		T entity = findOne(id);
    		if (entity != null) {
    			delete(entity);
    		} else {
    			throw new NotFoundException("The entity could not be found and was not deleted");
    		}
    		return entity;
    	}
    
    }

  • #2
    Hey Stephane!

    Thanks for reporting this issue. I am able to reproduce this bug in STS 3.2.0 and it is already fixed for STS 3.3.0. :-)

    So you could go ahead and use the latest milestone build of 3.3.0 (M2 at the moment), or wait for the 3.3.0 release in July. In the meantime, you could disable that validation in the project preferences (Spring -> Project Validators -> Data Validator -> Invalid Derived Query) by either de-activating the validation or configuring it to produce a warning instead of an error, for example.

    HTH,
    -Martin

    Comment


    • #3
      Hi Martin,

      Thanks for your quick, detailed and helpful feedback ! I shall wait for the coming release in July, no hurry.

      Kind Regards,

      Stephane

      Comment

      Working...
      X