Subject Firebird Spring Data JPA error: user lacks privilege or object not found:


I'm getting an error when I try to query a table for data using a Spring Data JPA

I know that my connection is working because I can query using Spring's JdbcTemplate style. I've extracted relevant code below:

T_ACCOUNT DDL table definition:



    ID           INTEGER,



The entity that I query is called Account.  It is mapped to the T_ACCOUNT defined above.  

Here's an extract of the entity definition:

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.Id;

import javax.persistence.Table;



public class Account {



private Long entityId;


private String creditCardNumber;

public Account() {



* Getter for the credit card number for this account.

* @return the credit card number for this account as a 16-character String.


public String getCreditCardNumber() {

return creditCardNumber;



* Setter for the credit card number for this account.

* @param creditCardNumber


public void setCreditCardNumber(String creditCardNumber) {

this.creditCardNumber = creditCardNumber;



* Returns the id for this account.


public Long getEntityId() {

return entityId;



* Sets the id for this account. Package local - only available to tests.


void setEntityId(Long entityId) {

this.entityId = entityId;



Here's the Spring Data Repository that will be used to run basic CRUD operations on the Account entity


public interface AccountRepository extends Repository<Account, Long> {

public Account findByCreditCardNumber(String creditCardNumber);


The repository gets wired into the implementation as follows:

public class RewardNetworkImpl implements RewardNetwork {

private AccountRepository accountRepository;


* Creates a new reward network.

* @param accountRepository the repository for loading accounts to reward


public RewardNetworkImpl(AccountRepository accountRepository) {

this.accountRepository = accountRepository;


For System Testing I add two config classes:

One for basic configuration and one for System Testing:

My Spring DataSource Configuration:

import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;


import org.springframework.transaction.annotation.EnableTransactionManagement;

import rewards.RewardNetwork;

import rewards.internal.RewardNetworkImpl;

import rewards.internal.account.AccountRepository;




public class RewardsConfig {

DataSource dataSource = createTestDataSource();


public RewardNetwork rewardNetwork(

AccountRepository accountRepository ) {

return new RewardNetworkImpl(






public RewardRepository rewardRepository(){


return repository;


    public DataSource createTestDataSource() {


        BasicDataSource dataSource = new BasicDataSource();






        return dataSource;




SystemTestConfig is used to wire the configuration together for testing:

package rewards;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

import org.springframework.boot.autoconfigure.domain.EntityScan;

import org.springframework.context.annotation.Configuration;

import org.springframework.context.annotation.Import;

import config.RewardsConfig;





public class SystemTestConfig {}

Finally, a test stub that calls AccountRepository.findByCreditCardNumber() method:

Account account = accountRepository.findByCreditCardNumber("1234");

When I invoke the findByCreditCardNumber method I get the following Hibernate Error:

ERROR: o.h.engine.jdbc.spi.SqlExceptionHelper - user lacks privilege or object not found: 

T_ACCOUNT in statement 

[select as id1_0_, account0_.credit_card as credit_c2_0_

from t_account account0_ 

where account0_.credit_card=?]

The SQL looks correct to me and I can invoke it directly on the database using IBExpert.  I also made note that the Credit Card Number is valid and is already present in the database.  If I query using JdbcTemplate, everything just works but I'd like to be able to use Spring Data JPA for lots of reasons.

This is for a Firebird 1.5 Database using jaybird-jdk18-2.2.10.jar.