使用JPA休眠创建表后,无法在Oracle数据库中获取表

问题描述 投票:0回答:1

我正在尝试使用Spring Boot连接Oracle Database 12c,并使用JPA hibernate创建表,并且在postman get和post正常工作中代码也运行良好(请求已命中并创建了表)。现在,当我在oracle数据库12c中检查表时,由于表不存在,因此我正在获取输出。

这是我的数据库连接文件

    ## Database Properties
    #spring.datasource.url = jdbc:mysql://localhost:3306/detail?useSSL=false
    spring.datasource.url= jdbc:oracle:thin:@<IP>:1521/<pdb database service name>
    spring.datasource.username=sys as sysdba
    spring.datasource.password=Welcome1
    spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
    ## Hibernate Properties
    # The SQL dialect makes Hibernate generate better SQL for the chosen database
    spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
    # Hibernate ddl auto (create, create-drop, validate, update)
    spring.jpa.hibernate.ddl-auto=update
    server.port=8081
    spring.jpa.show-sql=true

这是执行代码后的输出

    2020-01-31 16:06:40.916  WARN 7724 --- [  restartedMain] o.s.boot.StartupInfoLogger               : InetAddress.getLocalHost().getHostName() took 5006 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
    2020-01-31 16:06:45.927  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : Starting DemoApplication on Kirtis-Mac.local with PID 7724 (/Users/kirtijain/Downloads/demo/target/classes started by kirtijain in /Users/kirtijain/Downloads/demo)
    2020-01-31 16:06:45.927  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : No active profile set, falling back to default profiles: default
    2020-01-31 16:06:46.341  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-01-31 16:06:46.342  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
    2020-01-31 16:06:46.351  INFO 7724 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data JDBC - Could not safely identify store assignment for repository candidate interface com.example.repository.UserRepository. If you want this repository to be a JDBC repository, consider annotating your entities with one of these annotations: org.springframework.data.relational.core.mapping.Table.
    2020-01-31 16:06:46.351  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8ms. Found 0 JDBC repository interfaces.
    2020-01-31 16:06:46.358  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-01-31 16:06:46.359  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-01-31 16:06:46.365  INFO 7724 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 6ms. Found 1 JPA repository interfaces.
    2020-01-31 16:06:46.506  INFO 7724 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$9bd21857] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-01-31 16:06:46.511  INFO 7724 --- [  restartedMain] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
    2020-01-31 16:06:46.523  INFO 7724 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-01-31 16:06:47.870  INFO 7724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
    2020-01-31 16:06:47.872  INFO 7724 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2020-01-31 16:06:47.873  INFO 7724 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.30]
    2020-01-31 16:06:47.950  INFO 7724 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2020-01-31 16:06:47.950  INFO 7724 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2016 ms
    2020-01-31 16:06:48.059  INFO 7724 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-01-31 16:06:48.076  INFO 7724 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Starting...
    2020-01-31 16:06:48.077  WARN 7724 --- [  restartedMain] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation.
    2020-01-31 16:06:53.326  INFO 7724 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-3 - Start completed.
    2020-01-31 16:06:53.326  INFO 7724 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
    Hibernate: create table test_table (id number(19,0) generated as identity, created_by varchar2(50 char) not null, created_date timestamp, email_address varchar2(255 char) not null, first_name varchar2(255 char) not null, last_modified_by varchar2(50 char), last_modified_date timestamp, last_name varchar2(255 char) not null, primary key (id))
    2020-01-31 16:07:02.689  INFO 7724 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-01-31 16:07:02.690  INFO 7724 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-01-31 16:07:02.699  INFO 7724 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
    2020-01-31 16:07:02.876  WARN 7724 --- [  restartedMain] 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
    2020-01-31 16:07:02.956  INFO 7724 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2020-01-31 16:07:03.142  INFO 7724 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
    2020-01-31 16:07:03.142  INFO 7724 --- [  restartedMain] com.example.DemoApplication              : Started DemoApplication in 32.29 seconds (JVM running for 753.748)
    2020-01-31 16:07:03.144  INFO 7724 --- [  restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
    spring started 

Oracle数据库中的结果

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9SM0xMTi5wbmcifQ==” alt =“在此处输入图像描述”>

oracle hibernate spring-boot
1个回答
0
投票
表在那里,所以您可能连接到错误的架构。您可以看到所在的架构
© www.soinside.com 2019 - 2024. All rights reserved.