Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.springframework.dao.InvalidDataAccessApiUsageException: object is not an instance of declaring class #132

Open
furlatq opened this issue Aug 25, 2021 · 0 comments

Comments

@furlatq
Copy link

furlatq commented Aug 25, 2021

Hi, I'm facing the following error and just can't figure out what's the solution for it... I made all configuration like specified but seems that my JPA context is not getting the right class for DataTablesRepository.

Here's what I have:

  • Spring version 4.1.1
  • Spring JPA 1.7.1
  • Java 7

My repository context xml:

<jpa:repositories factory-class="org.springframework.data.jpa.datatables.repository.DataTablesRepositoryFactoryBean"
    		base-package="br.com.xx.paginated.repository" />
    <jpa:repositories base-package="br.com.xx.repository" />

My repository declaration:

package br.com.xx.paginated.repository;
import org.springframework.data.jpa.datatables.repository.DataTablesRepository;

import br.com.xx.entity.AuditoriaProduto;

public interface AuditoriaProdutoRepository extends DataTablesRepository<AuditoriaProduto, Integer> {
}

My service class:

@Service	
public class AuditoriaProdutoServiceImpl implements AuditoriaProdutoService {

	@Autowired
	private AuditoriaProdutoRepository auditoriaProdutoRepository;

        @Override
	public DataTablesOutput<AuditoriaProduto> findAll(DataTablesInput dti) {
		return auditoriaProdutoRepository.findAll(dti);
	}
}

But when I inspect the repository, it has underlying class of SimpleJPARepository instead of the DataTables repository... then I get the error mentioned.

Any ideas of what I'm missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant