Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
spring数据和ORA-00942:表或视图不存在_Spring_Oracle_Spring Data - Fatal编程技术网

spring数据和ORA-00942:表或视图不存在

spring数据和ORA-00942:表或视图不存在,spring,oracle,spring-data,Spring,Oracle,Spring Data,我对Spring数据和Oracle 12数据库有一些有趣的问题 我得到 java.sql.SQLSyntaxErrorException: ORA-00942:表或视图不可用 存在 但当我使用JdbcTemplate时,它是有效的!Spring数据和JdbcTemplate使用相同的数据源。液化迁移也可以顺利进行 我曾尝试对模型使用模式,但没有成功 @Getter @Setter @Entity @Table(name = "tb_accounts", schema = "rx") public

我对Spring数据和Oracle 12数据库有一些有趣的问题

我得到

java.sql.SQLSyntaxErrorException:
ORA-00942:表或视图不可用 存在

但当我使用JdbcTemplate时,它是有效的!Spring数据和JdbcTemplate使用相同的数据源。液化迁移也可以顺利进行

我曾尝试对模型使用模式,但没有成功

@Getter
@Setter
@Entity
@Table(name = "tb_accounts", schema = "rx")
public class CustomerAccount {

   @Id
   @Column(name = "id")
   private String id;

   private String accountNo;
}

@Repository
public interface CustomerAccountRepository extends JpaRepository<CustomerAccount, String> {

}
@Getter
@塞特
@实体
@表(name=“tb\U账户”,schema=“rx”)
公共类CustomerAccount{
@身份证
@列(name=“id”)
私有字符串id;
私有字符串accountNo;
}
@存储库
公共接口CustomerAccountRepository扩展了JpaRepository{
}
但正如我所说,它与JdbcTemplate一起工作

@Repository
public class CustomerAccountDao {

    @Autowired
    private DataSource dataSource;

    private JdbcTemplate jdbcTemplate;

    @PostConstruct
    private void postConstruct() {
        jdbcTemplate = new JdbcTemplate(dataSource);
    }

    public List<CustomerAccount> findAll() {
    return jdbcTemplate.query("select * from tb_accounts", (rs, i) -> {

        CustomerAccount account = new CustomerAccount();
        account.setId(rs.getString("id"));

        return account;
    });
}
@存储库
公共类CustomerAccountDao{
@自动连线
私有数据源;
私有JdbcTemplate JdbcTemplate;
@施工后
构造后的私有void(){
jdbcTemplate=新的jdbcTemplate(数据源);
}
公共列表findAll(){
返回jdbcTemplate.query(“从tb_帐户中选择*,(rs,i)->{
CustomerAccount帐户=新CustomerAccount();
account.setId(rs.getString(“id”);
返回帐户;
});
}
迁移文件

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">

    <changeSet id="1" author="user1">
        <createTable tableName="tb_accounts">
            <column name="id" type="VARCHAR(256)">
                <constraints primaryKey="true"/>
            </column>
            <column name="accountNo" type="VARCHAR(256)"/>

        </createTable>

    </changeSet>

</databaseChangeLog>


有什么想法吗?我应该检查什么?我花了几个小时寻找原因,但没有任何帮助:(

它需要使用TB\U帐户而不是TB\U帐户…

您在
@表中声明了架构,但是您没有在本机查询中指定任何架构。本机查询可以使用架构和不使用架构。Spring数据的问题。我尝试了使用架构和不使用架构,但异常相同。我想这说明了错误的Spring Data query但是为什么…我猜JDBC_模板指的是存在的
TB_ACCOUNTS
表,而Spring Data试图查找不存在的
TB_ACCOUNTS
表。Oracle中的表名区分大小写,
TB_ACCOUNTS TB_ACCOUNTS
year,你是对的!我没有注意到你的消息。3分钟后找到了原因s前…它需要在哪里使用它?为什么?该死。我有同样的问题,这个答案不能解决它。