Connect the hibernate c3p0 data source to the Oracle database

Source: Internet
Author: User

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <beans xmlns = "http://www.springframework.org/schema/beans" <br/> xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" <br/> xsi: schemalocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> </P> <p> <! -- Define the data source bean and use the c3p0 data source to implement --> <br/> <bean id = "datasource" <br/> class = "com. mchange. v2.c3p0. combopooleddatasource "<br/> destroy-method =" close "> <br/> <! -- Specify the driver to connect to the database --> <br/> <property name = "driverclass" <br/> value = "oracle. JDBC. driver. oracledriver "/> <br/> <! -- Specify the URL to connect to the database --> <br/> <property name = "jdbcurl" <br/> value = "JDBC: oracle: thin: @ 192.168.1.102: 1521: orcl "/> <br/> <! -- Specify the username to connect to the database --> <br/> <property name = "user" value = "sys as sysdba"/> <br/> <! -- Specify the password to connect to the database --> <br/> <property name = "password" value = "wxp362387"/> <br/> <! -- Specify the maximum number of connections to the database connection pool --> <br/> <property name = "maxpoolsize" value = "40"/> <br/> <! -- Specify the minimum number of connections to the database connection pool --> <br/> <property name = "minpoolsize" value = "10"/> <br/> <! -- Specify the number of initial connections to the database connection pool --> <br/> <property name = "initialpoolsize" value = "10"/> <br/> <! -- Specify the maximum idle time for connection to the database connection pool --> <br/> <property name = "maxidletime" value = "20"/> <br/> </bean> <br/> <! -- Defines sessionfactory of hibernate --> <br/> <bean id = "sessionfactory" <br/> class = "org. springframework. orm. hibernate3.localsessionfactorybean "> <br/> <property name =" datasource "ref =" datasource "/> <br/> <! -- Configure hibernate parameters --> <br/> <property name = "hibernateproperties"> <br/> <props> <br/> <! -- Specify the database Dialect --> <br/> <prop key = "hibernate. dialect "> <br/> Org. hibernate. dialect. oracle9dialect <br/> </prop> <br/> <prop key = "show_ SQL"> true </prop> <br/> <prop key = "hibernate. hbm2ddl. auto "> Update </prop> <br/> <! -- JDBC execution of batch update statement size --> <br/> <prop key = "hibernate. JDBC. batch_size "> 20 </prop> <br/> </props> <br/> </property> <br/> <property name =" mappingresources "> <br/> <! -- Ing file --> <br/> <list> <br/> <value> XXXX. HBM. XML </value> </P> <p> </List> <br/> </property> <br/> </bean> <br/> <! -- Configure the Transaction Manager bean. Because Hibernate Persistence technology is used, the hibernatetranscationmanager Transaction Manager is used --> <br/> <bean id = "transactionmanager" <br/> class = "org. springframework. orm. hibernate3.hibernatetransactionmanager "> <br/> <! -- Inject sessionfactory reference to the transaction manager --> <br/> <property name = "sessionfactory" ref = "sessionfactory"/> <br/> </bean> <br/> <! -- Configure the transaction interceptor Bean --> <br/> <bean id = "transactioninterceptor" <br/> class = "org. springframework. transaction. interceptor. transactioninterceptor "> <br/> <! -- The transaction interceptor bean needs to inject a Transaction Manager dependency --> <br/> <property name = "transactionmanager" ref = "transactionmanager"/> <br/> <property name = "transactionattributes "> <br/> <! -- The following defines the transaction propagation Attributes --> <br/> <props> <br/> <prop key = "Save *"> propagation_required </prop> <br/> <prop key = "get *"> propagation_required, readonly </prop> <br/> <prop key = "find *"> propagation_required, readonly </prop> <br/> <prop key = "*"> propagation_required </prop> <br/> </props> <br/> </property> <br /> </bean> </P> <p> <! -- Defines the beannameautoproxycreator post-processor. beannameautoproxycreator automatically creates an AOP proxy for beans with strings or wildcards matching their names. --> <Br/> <bean <br/> class = "org. springframework. AOP. Framework. autoproxy. beannameautoproxycreator"> <br/> <! -- Specify which bean names are used to automatically generate a Service proxy --> <br/> <property name = "beannames"> <br/> <! -- The following are all the beans that require automatic transaction proxy Creation --> <br/> <list> <br/> <value> * Dao </value> <br/> <value> * imP </value> </P> <p> </List> <br/> <! -- You can add other beans that require automatic transaction proxy creation. --> <br/> </property> <br/> <! -- The following defines the transaction interceptor required by beannameautoproxycreator --> <br/> <property name = "interceptornames"> <br/> <list> <br/> <! -- New interceptor can be added here --> <br/> <value> transactioninterceptor </value> <br/> </List> <br/> </property> <br /> </bean> </P> <p> <! -- Configure system Dao components --> <br/> <bean id = "xxxxdao" class = "org. Boss. Dao. xxxxdaohibernate"> <br/> <! -- Sessionfactory reference required for dependency injection Dao component --> <br/> <property name = "sessionfactory" ref = "sessionfactory"> </property> <br/> </Bean> <br/> <! -- Configure the business logic component of the system --> <br/> <bean id = "xxxximp" class = "org. boss. service. xxxxmanagerimp "> <br/> <property name =" xxxxdao "ref =" xxxxdao "> </property> <br/> </bean> <br/> </beans> </P> <p>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.