Hibernate SQL dialect (hibernate.dialect) Spring configuration file Applicationcontext.xml

Source: Internet
Author: User
Tags sybase mailmessage

Transferred from: http://www.cnblogs.com/wj-wangjun/archive/2009/10/21/1587624.html

Hibernate SQL dialect (hibernate.dialect)
Database Hibernate dialect
DB2 Org.hibernate.dialect.DB2Dialect
DB2 as/400 Org.hibernate.dialect.DB2400Dialect
DB2 OS390 Org.hibernate.dialect.DB2390Dialect
PostgreSQL Org.hibernate.dialect.PostgreSQLDialect
Mysql Org.hibernate.dialect.MySQLDialect
MySQL with InnoDB Org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM Org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) Org.hibernate.dialect.OracleDialect
Oracle 9i/10g Org.hibernate.dialect.Oracle9Dialect
Sybase Org.hibernate.dialect.SybaseDialect
Sybase Anywhere Org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server Org.hibernate.dialect.SQLServerDialect
SAP DB Org.hibernate.dialect.SAPDBDialect
Informix Org.hibernate.dialect.InformixDialect
Hypersonicsql Org.hibernate.dialect.HSQLDialect
Ingres Org.hibernate.dialect.IngresDialect
Progress Org.hibernate.dialect.ProgressDialect
Mckoi SQL Org.hibernate.dialect.MckoiDialect
Interbase Org.hibernate.dialect.InterbaseDialect
Pointbase Org.hibernate.dialect.PointbaseDialect
Frontbase Org.hibernate.dialect.FrontbaseDialect
Firebird Org.hibernate.dialect.FirebirdDialect

<?xml version= "1.0" encoding= "GBK"?>

<!--Specify the schema information for the spring configuration file--
<beans xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
xmlns:tx= "Http://www.springframework.org/schema/tx"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
Http://www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
Http://www.springframework.org/schema/aop
Http://www.springframework.org/schema/aop/spring-aop-2.5.xsd ">

<!--define the data source bean, using the C3P0 data source to implement-
<bean id= "DataSource" destroy-method= "Close"
class= "Com.mchange.v2.c3p0.ComboPooledDataSource" >
<!--Specify the drive to connect to the database

<!--Specify the URL of the connection database--
<!--Specify the user name to connect to the database--
<!--specify a password to connect to the database--
<!--Specify the maximum number of connections to connect to a database connection pool--
<!--Specify the minimum number of connections to connect to the database connection pool--
<!--Specify the number of initialization connections to connect to the database connection pool-
<!--Specify the maximum idle time for connections that connect to a database connection pool-
<!--even MySQL
<property name= "Driverclass" value= "Com.mysql.jdbc.Driver"/>
<property name= "Jdbcurl"
Value= "Jdbc:mysql://localhost:3306/auction"/>
<property name= "User" value= "root"/>
<property name= "Password" value= "32147"/>
<property name= "maxpoolsize" value= "/>"
<property name= "Minpoolsize" value= "1"/>
<property name= "Initialpoolsize" value= "1"/>
<property name= "maxidletime" value= "/>"
-

<!--Lian Ms-sql-->
<property name= "Driverclassname"
Value= "Net.sourceforge.jtds.jdbc.Driver" ></property> <property
Name= "url"
Value= "Jdbc:jtds:sqlserver://10.11.68.28:1433;databasename=txdb" ></property>
<property name= "username" value= "sa" ></property>
<property name= "Password" value= "wang.jun2009" ></property>

<!--even Oracle--
<!--
<property name= "Driverclassname" value= "Oracle.jdbc.driver.OracleDriver" ></property>
<property name= "url" value= "JDBC:ORACLE:THIN:@10.12.3.106:1521:ORCL" ></property>

<property name= "username" value= "PMS" ></property>
<property name= "Password" value= "Zerobugpms" ></property>

<property name= "maxactive" value= "></property>"
<property name= "Maxidle" value= "></property>"
<property name= "maxwait" value= "></property>"
<property name= "Defaultautocommit" value= "true" ></property>
-
</bean>

<!--define Hibernate sessionfactory--
<bean id= "Sessionfactory"
class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >

<!--relies on the injected data source to inject the datasource defined above--
<property name= "DataSource" ref= "DataSource"/>
<!--The Mappingresouces property is used to list all mapping files--
<property name= "Mappingresources" >
<list>
<!--the following to list hibernate mapping files--
<value>org/crazyjava/auction/model/AuctionUser.hbm.xml</value>
<value>org/crazyjava/auction/model/Bid.hbm.xml</value>
<value>org/crazyjava/auction/model/Item.hbm.xml</value>
<value>org/crazyjava/auction/model/Kind.hbm.xml</value>
<value>org/crazyjava/auction/model/State.hbm.xml</value>
</list>
</property>
<!--defines the properties of Hibernate sessionfactory--
<property name= "Hibernateproperties" >
<props>
<!--specifying a database dialect---
<prop key= "Hibernate.dialect" >org.hibernate.dialect.SQLServerDialect</prop>
<!--
<prop key= "Hibernate.dialect" >
Org.hibernate.dialect.mysqlinnodbdialect</prop>
-
<!--if you want to automatically create a database every time--
<prop key= "Hibernate.hbm2ddl.auto" >update</prop>
<!--shows the SQL generated by Hibernate persistence operation--
<prop key= "Hibernate.show_sql" >true</prop>
<!--format the SQL script and then output--
<prop key= "Hibernate.format_sql" >true</prop>
</props>
</property>
</bean>

 <!--Configuring Hibernate's local transaction manager, using Hibernatetransactionmanager class-->
 <!-- This class implements the Platformtransactionmanager interface, which is a specific implementation--> for hibernate;
 <bean id= "TransactionManager" &NBSP;
  class= "Org.springframework.orm.hibernate3.HibernateTransactionManager";
  <!-- You need to configure Hibernatetransactionmanager by injecting sessionfactory reference-->
  <property name= "SessionFactory" ref = "Sessionfactory"/>
 </bean>

 <!--Configure the transaction slice bean, specify the transaction manager-->
 <tx:advice id= "Txadvice" transaction-manager= " TransactionManager
  <!--used to configure verbose transaction semantics-->
  <tx:attributes>
    <!--all methods that begin with ' get ' are read-only-->
   <tx:method name= "get*" read-only= "true "/>
   <!--Other methods use the default transaction settings-->
   <tx:method name=" * "/>
  </tx:attributes>
 </tx:advice>
 <aop:config>
  < !--Configure a pointcut to match all method--> for all Impl-terminated classes under the specified package;
  <aop:pointcut id= leeservice
    expression= "Execution (* org.crazyjava.auction.service.impl.*impl.* (..))" />
  <!--Specifies that the Txadvice transaction facet--> be applied at the Leeservice pointcut;
  <aop:advisor advice-ref= " Txadvice "&NBSP;
   pointcut-ref=" Leeservice "/>
 </aop:config>

<!--define Javamailsenderimpl, which is used to send messages--
<bean id= "MailSender"
class= "Org.springframework.mail.javamail.JavaMailSenderImpl" >
<!--Specify the SMTP server address to send mail to-
<property name= "host" value= "smtp.163.com"/>
<property name= "Javamailproperties" >
<props>
<prop key= "Mail.smtp.auth" >true</prop>
<prop key= "Mail.smtp.timeout" >25000</prop>
</props>
</property>
<!--Specify the user name, password--for the login mailbox
<property name= "username" value= "spring_test"/>
<property name= "Password" value= "123abc"/>
</bean>
<!--define the Simplemailmessage Bean, which represents a message--
<bean id= "MailMessage"
class= "Org.springframework.mail.SimpleMailMessage" >
<property name= "from" value= "[email protected]"/>
<!--Specify the message header--
<property name= "Subject" value= "spot notice"/>
</bean>

<!--configuring business logic Components--
<bean id= "Mgr"
class= "Org.crazyjava.auction.service.impl.AuctionManagerImpl" >
<!--inject the required DAO components into the business logic components--
<property name= "Userdao" ref= "Auctionuserdao"/>
<property name= "Biddao" ref= "Biddao"/>
<property name= "Itemdao" ref= "Itemdao"/>
<property name= "Kinddao" ref= "Kinddao"/>
<property name= "Statedao" ref= "Statedao"/>
<property name= "MailSender" ref= "MailSender"/>
<property name= "message" ref= "MailMessage"/>
</bean>
<!--Configure a timertask Bean--
<bean id= "Checkwiner" class= "Org.crazyjava.auction.schedule.CheckWiner" >
<!--Dependency Injection business logic components--
<property name= "Mgr" ref= "Mgr"/>
</bean>
<!--wrap TimerTask Bean:checkwiner as a recurring Task Scheduler Bean--
<bean id= "Scheduledtask"
class= "Org.springframework.scheduling.timer.ScheduledTimerTask" >
<!--specify dispatch frequency and delay--
<property name= "delay" value= "0"/>
<property name= "period" value= "86400000"/>
<property name= "TimerTask" ref= "Checkwiner"/>
</bean>
<!--start the actual dispatch--
<bean id= "Timerfactory"
class= "Org.springframework.scheduling.timer.TimerFactoryBean" >
<!--The following list of all Task Scheduler beans that need to be called--
<property name= "Scheduledtimertasks" >
<list>
<ref bean= "Scheduledtask"/>
</list>
</property>
</bean>
</beans>

Hibernate SQL dialect (hibernate.dialect) Spring configuration file Applicationcontext.xml

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.