使用Hibernate成功连接到Oracle需要3分钟

nkhmeac6  于 2023-05-22  发布在  Oracle
关注(0)|答案(1)|浏览(121)

朋友告诉我为什么使用Hibernate连接需要三分钟的原因。
在获得工厂的方法中:

sessionFactory = new Configuration().configure().buildSessionFactory();

hibernate.cfg.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@<IP>:1521:sbboldev</property>
        <property name="hibernate.connection.username">login</property>
        <property name="hibernate.connection.password">password</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
        <property name="hibernate.default_schema">login</property>
        <property name="show_sql">true</property>

        <mapping resource="Developer.hbm.xml"/>

    </session-factory>
</hibernate-configuration>

database_module.log

2019-02-08 12:06:08 DEBUG JdbcEnvironmentInitiator:72 - Database ->
       name : Oracle
    version : Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
      major : 11
      minor : 2
2019-02-08 12:06:08 DEBUG JdbcEnvironmentInitiator:83 - Driver ->
       name : Oracle JDBC driver
    version : 11.2.0.4.0
      major : 11
      minor : 2
2019-02-08 12:06:08 DEBUG JdbcEnvironmentInitiator:389 - JDBC version : 11.2
2019-02-08 12:06:08 INFO  Dialect:158 - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2019-02-08 **12:06:08** DEBUG DefaultSchemaNameResolver:53 - Unable to use Java 1.7 Connection#getSchema
2019-02-08 **12:09:15** DEBUG Namespace:51 - Created database namespace [logicalName=Name{catalog=null, schema=null}, physicalName=Name{catalog=null, schema=null}]
2019-02-08 12:09:15 DEBUG ModelBinder:239 - Mapping class: net.proselyte.hibernate.example.Developer -> HIBERNATE_DEVELOPERS

Hibernate核心版本:5.4.1.最终。Java版本:1.8.0_161

相关问题