使用Spring JPA使用同义词而不是表名访问Table [英] Accessing Table with synonym instead of table name with Spring JPA

查看:220
本文介绍了使用Spring JPA使用同义词而不是表名访问Table的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用过Spring JPA. 以下是我的POJO课:

I have used Spring JPA in my project. Following is my POJO class:

@Table (name="CustomerSys")
class Customer implements Serializable {
/* Fields defined here */
}

在我的数据库中,存在一个名为Customer的表,但是为了访问该表,我们创建了一个名为CustomerSys的同义词.现在,当我执行我的代码时,抛出错误:

In my database, there is a table exists with name Customer but to access that table we have created a synonym with name CustomerSys. Now when i execute my code it throwing an error says:

由以下原因引起:java.sql.SQLException:ORA-00942:表或视图不存在 存在

Caused by: java.sql.SQLException: ORA-00942: table or view does not exist

您能帮我知道我在这里想念什么吗?

Can you please help me to know what I am missing here?

推荐答案

在我的应用程序中,我使用了两个不同的数据源.我调试了该应用程序,发现由于此表或视图而导致映射的不正确数据源没有出现.所以, 1.我先更正映射,然后出现错误消息,消息中发现名称不正确的协议. 2.然后我用ojdbc6代替了ojdbc14.

In my application I have used two difference data sources. I debugg the the application and found that the incorrect data sources mapped due to this table or view does't exits appears. So, 1. I correct the mapping first, then a error msg appears with name incorrect protocol found. 2. Then I used ojdbc6 instead of ojdbc14.

这使我的应用程序正常工作.

This made my application working.

这篇关于使用Spring JPA使用同义词而不是表名访问Table的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆