- 浏览: 748889 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
lengzl:
请问,那个Node 是哪个包里面的类?
JAVA 二叉树的递归和非递归遍历 -
gongchuangsu:
总结的很好,感谢感谢
JAVA 二叉树的递归和非递归遍历 -
Caelebs:
666666666 居然是10年发的,难怪截屏自动保存的名字是 ...
截图工具 -
jijiqw:
是注解不是注释。。。
Spring @Transactional (一) -
letueo:
[b][b][b][b][b][b][b][b][b][b][ ...
Spring @Transactional (一)
想的很复杂,用起来就那么回事.
怎么回事呢???
就是把hibernate的配置
dataSource ----org.apache.commons.dbcp.BasicDataSource
sessionFactory -----org.springframework.orm.hibernate3.LocalSessionFactoryBean
交给Spring去管理.
spring再管理自己的事务,bean等.
配置好spring,加入jar文件,
加入hibernate的jar文件.
加入数据库jar.
先看看配置文件,强烈建议复制,手动写我就出错了.最后还是复制别人现成的.
注解先要找开哦.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="ff"/>
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="2"/>
<!-- 连接池的最大值 -->
<property name="maxActive" value="100"/>
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2"/>
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>com/liyu/bean/Person.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="personService" class="com.liyu.service.impl.PersonServiceBean"/>
</beans>
再写那个Person bean文件PO,映射文件,这是基本的,写不出来,就不用看了.
再写那个服务类的接口,这个也是每个类公用的,无难度,飞过.
重点是那个接口的实现类了.PersonServiceBean
package com.liyu.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.liyu.bean.Person;
import com.liyu.service.PersonService;
@Transactional
public class PersonServiceBean implements PersonService {
@Resource private SessionFactory sessionFactory;
public void delete(Integer personid) {
sessionFactory.getCurrentSession().delete(
sessionFactory.getCurrentSession().load(Person.class, personid));
}
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
public Person getPerson(Integer personid) {
return (Person)sessionFactory.getCurrentSession().get(Person.class, personid);
}
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
@SuppressWarnings("unchecked")
public List<Person> getPersons() {
return sessionFactory.getCurrentSession().createQuery("from Person").list();
}
public void save(Person person) {
sessionFactory.getCurrentSession().persist(person);
}
public void update(Person person) {
sessionFactory.getCurrentSession().merge(person);
}
看看测试文件:
package com.liyu.test;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.liyu.bean.Person;
import com.liyu.service.PersonService;
public class SshTest {
public static void main(String[] args) {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
PersonService ps = (PersonService)applicationContext.getBean("personService");
//增加一条记录
//ps.save(new Person("wang da"));
//查找一条记录
//Person p=ps.getPerson(7);
//System.out.println(p.getName());
//p.setName("FFFF3");
//更新记录
//ps.update(p);
//p=ps.getPerson(2);
//System.out.println(p.getName());
//删除记录
//ps.delete(6);
List<Person> list=ps.getPersons();
for(Person p:list){
System.out.println(p.getName());
}
}
运行的结果:
2010-6-17 14:54:34 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6: display name [org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6]; startup date [Thu Jun 17 14:54:34 CST 2010]; root of context hierarchy
2010-6-17 14:54:34 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [beans.xml]
2010-6-17 14:54:35 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6]: org.springframework.beans.factory.support.DefaultListableBeanFactory@18a49e0
2010-6-17 14:54:35 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@18a49e0: defining beans [org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dataSource,sessionFactory,txManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,personService]; root of factory hierarchy
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: Hibernate 3.2.6
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: hibernate.properties not found
2010-6-17 14:54:35 org.hibernate.cfg.Environment buildBytecodeProvider
信息: Bytecode provider name : cglib
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: using JDK 1.4 java.sql.Timestamp handling
2010-6-17 14:54:35 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
信息: Mapping class: com.liyu.bean.Person -> person
2010-6-17 14:54:35 org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
信息: Building new Hibernate SessionFactory
2010-6-17 14:54:35 org.hibernate.connection.ConnectionProviderFactory newConnectionProvider
信息: Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: RDBMS: MySQL, version: 5.1.42-community
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} )
2010-6-17 14:54:35 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.MySQL5Dialect
2010-6-17 14:54:35 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
2010-6-17 14:54:35 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch size: 15
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch updates for versioned data: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Maximum outer join fetch depth: 2
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL inserts for batching: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2010-6-17 14:54:35 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JPA-QL strict compliance: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory createCacheProvider
信息: Cache provider: org.hibernate.cache.EhCacheProvider
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Named query checking : enabled
2010-6-17 14:54:36 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2010-6-17 14:54:36 net.sf.ehcache.config.ConfigurationFactory parseConfiguration
警告: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/java/SSH/WebRoot/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xml
2010-6-17 14:54:36 org.hibernate.cache.EhCacheProvider buildCache
警告: Could not find configuration [cn.itcast.bean.Person]; using defaults.
2010-6-17 14:54:36 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: Running hbm2ddl schema update
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: fetching database metadata
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: updating schema
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: table found: test.person
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: columns: [id, name]
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: foreign keys: []
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: indexes: [primary]
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: schema update complete
2010-6-17 14:54:36 org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
信息: Using DataSource [org.apache.commons.dbcp.BasicDataSource@1955970] of Hibernate SessionFactory for HibernateTransactionManager
FFFF1
xxx05
xxx06
FFFF3
怎么回事呢???
就是把hibernate的配置
dataSource ----org.apache.commons.dbcp.BasicDataSource
sessionFactory -----org.springframework.orm.hibernate3.LocalSessionFactoryBean
交给Spring去管理.
spring再管理自己的事务,bean等.
配置好spring,加入jar文件,
加入hibernate的jar文件.
加入数据库jar.
先看看配置文件,强烈建议复制,手动写我就出错了.最后还是复制别人现成的.
注解先要找开哦.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.gjt.mm.mysql.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="ff"/>
<!-- 连接池启动时的初始值 -->
<property name="initialSize" value="2"/>
<!-- 连接池的最大值 -->
<property name="maxActive" value="100"/>
<!-- 最大空闲值.当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
<property name="maxIdle" value="2"/>
<!-- 最小空闲值.当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰来时来不及申请 -->
<property name="minIdle" value="1"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>com/liyu/bean/Person.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="personService" class="com.liyu.service.impl.PersonServiceBean"/>
</beans>
再写那个Person bean文件PO,映射文件,这是基本的,写不出来,就不用看了.
再写那个服务类的接口,这个也是每个类公用的,无难度,飞过.
重点是那个接口的实现类了.PersonServiceBean
package com.liyu.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.liyu.bean.Person;
import com.liyu.service.PersonService;
@Transactional
public class PersonServiceBean implements PersonService {
@Resource private SessionFactory sessionFactory;
public void delete(Integer personid) {
sessionFactory.getCurrentSession().delete(
sessionFactory.getCurrentSession().load(Person.class, personid));
}
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
public Person getPerson(Integer personid) {
return (Person)sessionFactory.getCurrentSession().get(Person.class, personid);
}
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
@SuppressWarnings("unchecked")
public List<Person> getPersons() {
return sessionFactory.getCurrentSession().createQuery("from Person").list();
}
public void save(Person person) {
sessionFactory.getCurrentSession().persist(person);
}
public void update(Person person) {
sessionFactory.getCurrentSession().merge(person);
}
看看测试文件:
package com.liyu.test;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.liyu.bean.Person;
import com.liyu.service.PersonService;
public class SshTest {
public static void main(String[] args) {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
PersonService ps = (PersonService)applicationContext.getBean("personService");
//增加一条记录
//ps.save(new Person("wang da"));
//查找一条记录
//Person p=ps.getPerson(7);
//System.out.println(p.getName());
//p.setName("FFFF3");
//更新记录
//ps.update(p);
//p=ps.getPerson(2);
//System.out.println(p.getName());
//删除记录
//ps.delete(6);
List<Person> list=ps.getPersons();
for(Person p:list){
System.out.println(p.getName());
}
}
运行的结果:
2010-6-17 14:54:34 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6: display name [org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6]; startup date [Thu Jun 17 14:54:34 CST 2010]; root of context hierarchy
2010-6-17 14:54:34 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [beans.xml]
2010-6-17 14:54:35 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@18ee9d6]: org.springframework.beans.factory.support.DefaultListableBeanFactory@18a49e0
2010-6-17 14:54:35 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@18a49e0: defining beans [org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dataSource,sessionFactory,txManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,personService]; root of factory hierarchy
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: Hibernate 3.2.6
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: hibernate.properties not found
2010-6-17 14:54:35 org.hibernate.cfg.Environment buildBytecodeProvider
信息: Bytecode provider name : cglib
2010-6-17 14:54:35 org.hibernate.cfg.Environment <clinit>
信息: using JDK 1.4 java.sql.Timestamp handling
2010-6-17 14:54:35 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
信息: Mapping class: com.liyu.bean.Person -> person
2010-6-17 14:54:35 org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
信息: Building new Hibernate SessionFactory
2010-6-17 14:54:35 org.hibernate.connection.ConnectionProviderFactory newConnectionProvider
信息: Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: RDBMS: MySQL, version: 5.1.42-community
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.7 ( Revision: ${svn.Revision} )
2010-6-17 14:54:35 org.hibernate.dialect.Dialect <init>
信息: Using dialect: org.hibernate.dialect.MySQL5Dialect
2010-6-17 14:54:35 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
信息: Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
2010-6-17 14:54:35 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
信息: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic flush during beforeCompletion(): disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Automatic session close at end of transaction: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch size: 15
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC batch updates for versioned data: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Scrollable result sets: enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JDBC3 getGeneratedKeys(): enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Connection release mode: auto
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Maximum outer join fetch depth: 2
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default batch fetch size: 1
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Generate SQL with comments: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL updates by primary key: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Order SQL inserts for batching: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
信息: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2010-6-17 14:54:35 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
信息: Using ASTQueryTranslatorFactory
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query language substitutions: {}
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: JPA-QL strict compliance: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Second-level cache: enabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Query cache: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory createCacheProvider
信息: Cache provider: org.hibernate.cache.EhCacheProvider
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Optimize cache for minimal puts: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Structured second-level cache entries: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Statistics: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Deleted entity synthetic identifier rollback: disabled
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Default entity-mode: pojo
2010-6-17 14:54:35 org.hibernate.cfg.SettingsFactory buildSettings
信息: Named query checking : enabled
2010-6-17 14:54:36 org.hibernate.impl.SessionFactoryImpl <init>
信息: building session factory
2010-6-17 14:54:36 net.sf.ehcache.config.ConfigurationFactory parseConfiguration
警告: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/java/SSH/WebRoot/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xml
2010-6-17 14:54:36 org.hibernate.cache.EhCacheProvider buildCache
警告: Could not find configuration [cn.itcast.bean.Person]; using defaults.
2010-6-17 14:54:36 org.hibernate.impl.SessionFactoryObjectFactory addInstance
信息: Not binding factory to JNDI, no JNDI name configured
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: Running hbm2ddl schema update
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: fetching database metadata
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: updating schema
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: table found: test.person
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: columns: [id, name]
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: foreign keys: []
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.TableMetadata <init>
信息: indexes: [primary]
2010-6-17 14:54:36 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
信息: schema update complete
2010-6-17 14:54:36 org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
信息: Using DataSource [org.apache.commons.dbcp.BasicDataSource@1955970] of Hibernate SessionFactory for HibernateTransactionManager
FFFF1
xxx05
xxx06
FFFF3
发表评论
-
Struts2 xwork中ActionContext和ServletActionContext介绍
2011-03-21 11:26 1440ActionContext(Action上下文) ... -
Struts,Hibernate,Spring经典面试题收藏
2010-12-06 08:44 1332Struts,Hibernate,Spring经 ... -
struts1.2中ActionForm的理解
2010-12-03 14:43 1735初学struts的人我认为首 ... -
struts-config.xml 详解
2010-12-03 12:04 966弄清楚struts-config.xml中各项元素的作用,对于 ... -
struts global-exceptions用法
2010-12-03 11:56 1575在用struts框架写web程序时,有可能会遇到很多异常,如u ... -
<servlet-mapping>元素及其子元素
2010-12-03 11:04 1403<servlet-mapping>元素 ... -
servlet mapping 规则
2010-12-03 10:43 1434servlet mapping有三种<url-patte ... -
常用log4j配置
2010-12-03 09:48 926常用log4j配置 常用log4j配置,一般可以采用两种方 ... -
Log4j简介
2010-12-03 09:47 803在强调可重用组件开发的今天,除了自己从头到尾开发一个可重用 ... -
log4j配置祥解
2010-12-03 09:46 994第一步:加入log4j-1.2.8.j ... -
数据库连接池DBCP
2010-12-02 14:54 1060概念:数据库连接池负责分配、管理和释放数据库连接,它允许应用程 ... -
Hibernate持久化对象三种状态的区分,以及save,update,saveOrUpdate,merge,persist等的使用
2010-11-12 20:22 1575Hibernate的对象有3种状态,分别为:瞬时态(Trans ... -
Hibernate持久化对象
2010-11-12 20:20 1225一,持久化对象: 1,置于session管理下的对象叫做持久化 ... -
hibernate核心类简介
2010-11-12 20:16 1164Hibernate Hibernate是一 ... -
J2EE是什么语言
2010-11-11 12:42 5994****** 版权声明 ******** * 在完整保留 ... -
Hibernate最基础的示例
2010-11-04 15:06 1478有关Spring的知识大部分都已经温习完毕,今天开始转向H ... -
struts+spring+hibernate是怎样的架构?
2010-11-01 17:21 1094struts+spring+hibernate是怎 ... -
快速整合struts+spring+hibernate
2010-11-01 17:17 975说明: 使用平台:Eclipse3.2、MyEclipse5 ... -
Spring整合Hibernate
2010-11-01 15:34 1183Spring整合Hibernate的价值在于Spring为Hi ... -
一些有用的网址
2010-11-01 15:10 1008http://wenku.baidu.com/view/7ab ...
相关推荐
《疯狂Ajax讲义:Prototype/jQuery+DWR+Spring+Hibernate整合开发》是疯狂Java体系丛书之一,前8章基本以XHTML、JavaScript和DOM编程为主,无须任何基础即可阅读;第9章以后的内容则需要掌握Spring、Hibernate等Java ...
《WebWork.Spring.Hibernate整合开发网络书城》这个主题涵盖了三个关键的技术框架:WebWork、Spring和Hibernate。这些技术在现代企业级Java应用开发中扮演着至关重要的角色,特别是对于构建复杂的、数据驱动的Web...
本资源为轻量级 J2EE 企业应用实战开发笔记,涵盖 Struts、Spring 和 Hibernate 三大框架的整合开发实践。笔记从 JDK 安装和配置环境变量开始,接着介绍了 JSP 的技术原理和使用方法,包括 JSP 注释、声明、表达式、...
轻量级Java EE企业应用实战——Struts 2+Spring+Hibernate整合开发电子书123全套.part3.rar
在《轻量级 J2EE 企业应用实战:Struts+Spring+Hibernate 整合开发》这本书中,读者可以期待学习到如何配置和使用这三个框架,理解它们之间的协作方式,以及如何在实际项目中有效地应用SSH架构。书中可能涵盖从基本...
《轻量级Java EE企业应用实战——Struts 2+Spring+Hibernate整合开发电子书1》是一本专注于Java EE企业级应用开发的书籍,主要涵盖了Struts 2、Spring和Hibernate这三个流行开源框架的整合应用。这本书对于Java...
这个“Spring+hibernate整合源代码”应该包含了实现上述整合步骤的示例代码,可以作为学习和参考的资源。通过学习和实践这些代码,你可以更好地理解和掌握 Spring 和 Hibernate 整合的细节,提升你的 Java Web 开发...
在本教程中,我们将深入探讨如何使用Spring MVC、Spring和Hibernate三大框架进行全注解的整合开发。这个视频教程系列的第11部分,重点可能是建立在前几部分的基础之上,进一步深化对这三个核心技术的理解和实践。 ...
轻量级JavaEE企业应用实战_Struts2+Spring3+Hibernate整合开发_第3版.part5
在本教程中,我们将深入探讨如何使用Spring MVC、Spring和Hibernate三大...通过本教程的学习,你将能够掌握基于注解的Spring MVC、Spring和Hibernate整合开发,为构建高效、可维护的Java Web应用程序打下坚实的基础。
在本教程中,我们将深入探讨如何使用Spring MVC、Spring和Hibernate三大框架进行全注解的整合开发。这个视频教程系列的第12部分,将帮助开发者掌握如何在Java Web项目中高效地集成这三个核心框架,实现松耦合、可...
《Spring与Hibernate整合详解》 在现代Java Web开发中,Spring和Hibernate是两个非常重要的开源框架,它们分别在依赖注入和对象关系映射(ORM)领域有着广泛的应用。Spring作为一个全面的轻量级应用框架,提供了...
在"25_黑马程序员_黎活明_Spring2.5视频教程_搭建和配置Spring与Hibernate整合的环境.avi"这个文件中,可能详细演示了如何配置这些库到项目的类路径中。 接着,需要配置Spring的IoC容器。这可以通过XML配置文件完成...
《轻量级J2EE企业应用实战--Struts+Spring+Hibernate整合开发》源码.part6
《轻量级J2EE企业应用实战--Struts+Spring+Hibernate整合开发》图书配套源码part1
比较流行的一本书,在公司内很受欢迎 比较实用 下半部分,需与上半部分放在一起解压。
轻量级JavaEE企业应用实战_Struts2+Spring3+Hibernate整合开发_第3版.part2
通过以上步骤,一个基本的Struts、Spring和Hibernate整合的应用就搭建完成了。这个整合的关键在于Struts处理HTTP请求,Spring管理业务对象和依赖,而Hibernate则处理数据库操作。这样的架构可以实现松耦合,便于代码...