我尝试连接到Oracle SQL,一切正常,控制台通知连接成功,控制台没有错误:
2023-04-27 17:28:50 INFO [main ] m.service.promotion.PromotionApplication : No active profile set, falling back to default profiles: default
2023-04-27 17:28:50 INFO [main ] y.config.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-04-27 17:28:50 INFO [main ] y.config.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 31ms. Found 0 JPA repository interfaces.
2023-04-27 17:28:50 INFO [main ] amework.cloud.context.scope.GenericScope : BeanFactory id=d5b7dc3c-7593-38a4-b712-ceb098e944ec
2023-04-27 17:28:50 INFO [main ] boot.web.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9004 (http)
2023-04-27 17:28:50 INFO [main ] org.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-04-27 17:28:50 INFO [main ] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2023-04-27 17:28:51 INFO [main ] e.ContainerBase.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-04-27 17:28:51 INFO [main ] ntext.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 938 ms
2023-04-27 17:28:51 INFO [main ] rg.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-04-27 17:28:51 INFO [main ] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2023-04-27 17:28:51 INFO [main ] org.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-04-27 17:28:51 INFO [main ] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-04-27 17:28:51 INFO [main ] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-04-27 17:28:51 INFO [main ] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:32 WARN [main ] t.internal.InFlightMetadataCollectorImpl : HHH000069: Duplicate generator name SEQ_STORE
2023-04-27 17:29:34 INFO [main ] a.platform.internal.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-04-27 17:29:34 INFO [main ] a.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-04-27 17:29:34 WARN [main ] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-04-27 17:29:34 INFO [main ] duling.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
但是当我使用代码运行API时,这段代码从数据库中获取实体客户:
Customer customer = commonMgr.getEntityById(Customer.class, customerId);
我有一个错误:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:747) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:904) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1082) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3822) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1165) ~[ojdbc8-12.2.0.1.jar:12.2.0.1.0]
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java) ~[HikariCP-3.4.5.jar:na]
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
这是一个客户类:
package com.service.promotion.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import com.service.promotion.enumtype.ActiveType;
import com.service.promotion.enumtype.IsAttribute;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
@Entity
@Table(name = "CUSTOMER")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "CUSTOMER_SEQ", allocationSize = 1)
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
@Column(name = "CUSTOMER_ID")
private Long id;
}
我认为我的应用程序与Oracle数据库连接,但我下面的错误.帮我解决!谢谢大家!
2条答案
按热度按时间cnjp1d6j1#
首先,你是否尝试在代码中使用用户凭据连接数据库,以检查表是否实际存在,或者使用Oracle SQL Developer等数据库客户端?
发生此错误的原因如下。
请检查这些条件之一是否适用于您的代码。
bq3bfh9z2#
您可以验证您是否有权访问此表和/或表'CUSTOMER'存在尝试以下操作:选择owner作为schema_name,table_name from sys。all_tables where table_name like 'CUSTOMER';
关于https://dataedo.com/kb/query/oracle/find-tables-which-names-start-with-specific-prefix的更多信息