java - How to use WebLogic configured connection pool (with JNDI Name) in Spring Hibernate Oracle DB -


i'm new @ , i'm stuck. if help, great. code right uses inbuilt connection pool, how change weblogic configured connection pool ? code right below:

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> <!-- database connection settings --> <property name="connection.driver_class">oracle.jdbc.driver.oracledriver</property>  <!-- jdbc connection pool (use built-in) --> <property name="connection.pool_size">1</property>          <property name="hibernate.connection.release_mode">after_transaction</property>  <!-- sql dialect --> <property name="dialect">org.hibernate.dialect.oracle10gdialect</property>  <!-- configure blob/clob settings in hibernate --> <property name="hibernate.connection.setbigstringtryclob">true</property> <property name="hibernate.jdbc.batch_size">0</property>  <!--enable hibernate's automatic session context management --> <property name="current_session_context_class">thread</property>  <!-- disable second-level cache --> <property name="cache.provider_class">org.hibernate.cache.nocacheprovider</property> <property name="cache.use_query_cache">false</property>         <property name="cache.use_minimal_puts">false</property>         <property name="max_fetch_depth">3</property>  <!-- bind getcurrentsession() method thread. -->         <property name="current_session_context_class">thread</property>  <!-- echo executed sql stdout --> <property name="show_sql">true</property>   </session-factory> </hibernate-configuration> 

hibernate session class has getsession method:

public class hibernatesession {        public session getsession() {       configuration configuration = new annotationconfiguration();       configuration.setproperty("hibernate.connection.username", username);      configuration.setproperty("hibernate.connection.password", password);      configuration.setproperty("hibernate.connection.url", db_url);      configuration.configure("hibernate.cfg.xml");      sessionfactory sessionfactory = configuration.buildsessionfactory();      session session = sessionfactory.getcurrentsession();       return session;      } } 

hibernate version: 4.2.11.final weblogic: 10.3.6

you need use jndi lookup datasource configured via weblogic admin console.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -