Hibernate SQL dialect (dialect) Introduction, hibernatedialect
Hibernate SQL dialect (hibernate. dialect) Spring configuration file applicationContext. xml 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 |
SS |
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 of 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 and use the C3P0 data source -->
<Bean id = "dataSource" destroy-method = "close"
Class = "com. mchange. v2.c3p0. ComboPooledDataSource">
<! -- Specify the driver used to connect to the database -->
<! -- Specify the URL to connect to the database -->
<! -- Specify the username used to connect to the database -->
<! -- Specify the password to connect to the database -->
<! -- Specify the maximum number of connections to the database connection pool -->
<! -- Specify the minimum number of connections to the database connection pool -->
<! -- Specify the number of initial connections to the database connection pool -->
<! -- Specify the maximum idle time for connection to the database connection pool -->
<! -- Connect to 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 = "40"/>
<Property name = "minPoolSize" value = "1"/>
<Property name = "initialPoolSize" value = "1"/>
<Property name = "maxIdleTime" value = "20"/>
-->
<! -- Connect 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>
<! -- Connect to 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 = "100"> </property>
<Property name = "maxIdle" value = "30"> </property>
<Property name = "maxWait" value = "500"> </property>
<Property name = "defaultAutoCommit" value = "true"> </property>
-->
</Bean>
<! -- Define SessionFactory of Hibernate -->
<Bean id = "sessionFactory"
Class = "org. springframework. orm. hibernate3.LocalSessionFactoryBean">
<! -- Inject dependency to the data source and inject the dataSource defined above -->
<Property name = "dataSource" ref = "dataSource"/>
<! -- MappingResouces attribute used to list all ing files -->
<Property name = "mappingResources">
<List>
<! -- The following is a list of Hibernate ing 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>
<! -- Define the SessionFactory attribute of Hibernate -->
<Property name = "hibernateProperties">
<Props>
<! -- Specify database Dialect -->
<Prop key = "hibernate. dialect"> org. hibernate. dialect. SQLServerDialect </prop>
<! --
<Prop key = "hibernate. dialect">
Org. hibernate. dialect. MySQLInnoDBDialect </prop>
-->
<! -- Whether to automatically create a database as needed -->
<Prop key = "hibernate. hbm2ddl. auto"> update </prop>
<! -- Display the SQL statement generated by the Hibernate Persistence operation -->
<Prop key = "hibernate. show_ SQL"> true </prop>
<! -- Format the SQL script and then output it -->
<Prop key = "hibernate. format_ SQL"> true </prop>
</Props>
</Property>
</Bean>
<! -- Configure the local Transaction Manager of Hibernate and use the HibernateTransactionManager class -->
<! -- This class implements the PlatformTransactionManager interface, which is specific to Hibernate implementation -->
<Bean id = "transactionManager"
Class = "org. springframework. orm. hibernate3.HibernateTransactionManager">
<! -- When configuring HibernateTransactionManager, you must reference SessionFactory injection. -->
<Property name = "sessionFactory" ref = "sessionFactory"/>
</Bean>
<! -- Configure the transaction aspect Bean and specify the Transaction Manager -->
<Tx: advice id = "txAdvice" transaction-manager = "transactionManager">
<! -- Used to configure detailed transaction semantics -->
<Tx: attributes>
<! -- All Methods Starting with 'get' are read-only -->
<Tx: method name = "get *" read-only = "true"/>
<! -- Use the default transaction settings for other methods -->
<Tx: method name = "*"/>
</Tx: attributes>
</Tx: advice>
<Aop: config>
<! -- Configure an entry point to match all methods executed by all classes ending with Impl in the specified package -->
<Aop: pointcut id = "leeService"
Expression = "execution (* org. crazyjava. auction. service. impl. * Impl. * (...)"/>
<! -- Specify to apply the txAdvice transaction aspect at the leeService entry point -->
<Aop: advisor advice-ref = "txAdvice"
Pointcut-ref = "leeService"/>
</Aop: config>
<! -- Defines JavaMailSenderImpl, which is used to send emails -->
<Bean id = "mailSender"
Class = "org. springframework. mail. javamail. JavaMailSenderImpl">
<! -- Specify the SMTP server address for sending mail -->
<Property name = "host" value = "smtp.163.com"/>
<Property name = "javaMailProperties">
<Props>
<Prop key = "mail. smtp. auth"> true </prop>
<Prop key = "mail. smtp. Time Out"> 25000 </prop>
</Props>
</Property>
<! -- Specify the username and password of the logon email -->
<Property name = "username" value = "spring_test"/>
<Property name = "password" value = "123abc"/>
</Bean>
<! -- Defines SimpleMailMessage Bean, which represents an email -->
<Bean id = "mailMessage"
Class = "org. springframework. mail. SimpleMailMessage">
<Property name = "from" value = "spring_test@163.com"/>
<! -- Specify the mail title -->
<Property name = "subject" value = "bidding notification"/>
</Bean>
<! -- Configure the business logic component -->
<Bean id = "mgr"
Class = "org. crazyjava. auction. service. impl. AuctionManagerImpl">
<! -- Inject the required DAO component into the business logic component -->
<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 component -->
<Property name = "mgr" ref = "mgr"/>
</Bean>
<! -- Wrap TimerTask Bean: checkWiner into a task scheduling Bean that can be executed cyclically -->
<Bean id = "scheduledTask"
Class = "org. springframework. scheduling. timer. ScheduledTimerTask">
<! -- Specify the scheduling frequency and latency -->
<Property name = "delay" value = "0"/>
<Property name = "period" value = "86400000"/>
<Property name = "timerTask" ref = "checkWiner"/>
</Bean>
<! -- Start the actual scheduling -->
<Bean id = "timerFactory"
Class = "org. springframework. scheduling. timer. TimerFactoryBean">
<! -- The following lists all the task scheduling beans to be called -->
<Property name = "scheduledTimerTasks">
<List>
<Ref bean = "scheduledTask"/>
</List>
</Property>
</Bean>
</Beans>