摘要: 1.windows下在启动服务启动监听:lsnrctl start启动服务:oradim -startup -sid orcl2.以sys身份进入 sqlplus /[@orcl] as sysdba 通过此方式就是以sys登陆3.show users显示为"sys"4.创建用户与授权SQL> create user lisi identified by lisi;用户已创建。SQL> grant create session to lisi;授权成功。SQL> grant unlimited tablespace to lisi;授权成功。SQL> 阅读全文
posted @ 2011-12-29 20:04 tazi 阅读(1310) 评论(0) 推荐(0) 编辑
摘要: 1.默认都是类构造器实例化<bean id=" XX" class=""/>2.静态工厂方法。工厂类的方法是static的,直接在bean中配置class为工厂类,factory-method为指定static方法。<bean id="ps" class="com.tazi.service.PersonServiceFactory" factory-method="createPersonServiceBean"/>public classPersonServiceFac 阅读全文
posted @ 2011-12-29 19:36 tazi 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 1 import java.beans.Introspector; 2 import java.beans.PropertyDescriptor; 3 import java.lang.reflect.Method; 4 import java.net.URL; 5 import java.util.ArrayList; 6 import java.util.HashMap; 7 import java.util.List; 8 import java.util.Map; 9 10 import org.apache.commons.beanutils.ConvertUt... 阅读全文
posted @ 2011-12-29 19:26 tazi 阅读(423) 评论(0) 推荐(0) 编辑
摘要: 1.配置src/META-INF下persistence.xml注意文件名是固定的。 1 <?xml version="1.0" encoding="UTF-8"?> 2 <persistence xmlns="http://java.sun.com/xml/ns/persistence" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://java.sun.com/xm 阅读全文
posted @ 2011-12-28 10:40 tazi 阅读(970) 评论(0) 推荐(0) 编辑
摘要: 使用注解方式 1 package junit.test; 2 3 import static org.junit.Assert.*; 4 5 import org.junit.BeforeClass; 6 import org.junit.Test; 7 import org.springframework.context.ApplicationContext; 8 import org.springframework.context.support.ClassPathXmlApplicationContext; 9 10 import com.tazi.domin.Person;11 i.. 阅读全文
posted @ 2011-12-28 10:34 tazi 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 加入context命名空间xmlns:context="http://www.springframework.org/schema/context"和xsi:schemaLocation中加上http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd然后使用<context:property-placeholder location="classpath:jdbc.properties&qu 阅读全文
posted @ 2011-12-28 10:30 tazi 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 这里使用spring2.51.配置数据源2.配置Spring事务管理使用Spring的事务管理功能,则事务的开启、提交、回滚都不用手工进行。使用注解方式(推荐)或者使用xml方式。Spring提供了针对数据源的数据源事务管理器,1 <!-- 数据源事务管理器 -->2 <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" >3 <property name="dataSource&q 阅读全文
posted @ 2011-12-28 10:27 tazi 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 大部分仍然使用javax.persistence中的注解,有些Hibernate扩展的注解,在org.hibernate.annotations包中,如GenericGenerator.使用hibernate.cfg.xml中配置的事务,使用<mapping class="完整类名"/>加载注解的持久化类。Hibernate中可以混合使用注解和xml映射文件。注解后不能使用Configuration类,而是AnnotationConfiguration类初始化Hibernate1 SessionFactory sFactory=new AnnotationCon 阅读全文
posted @ 2011-12-27 17:48 tazi 阅读(524) 评论(0) 推荐(0) 编辑
摘要: 使用@Transactional注解声明Bean底下所有业务方法需要事务管理。1.默认一个业务方法开启和结束事务,什么时候提交,什么时候回滚呢?Spring容器默认情况下对于运行期异常(unchecked Exception)会进行事务回滚,如果是用户违例(checked Exception),事务不会回滚。运行期违例:throw new RuntimeException("XXX");运行期违例不需要使用try/catch捕捉,编译可以通过用户违例,throw new Exception("XXX");必须使用try/catch捕捉,否则编译不能通过。 阅读全文
posted @ 2011-12-27 14:21 tazi 阅读(720) 评论(0) 推荐(0) 编辑
摘要: 1.可以使用Spring注解来注入所依赖的对象@ResourceSessionFactory sessionFactory2.可以利用Spring提供的Open Session In View过滤器org.springframework.orm.hibernate3.support.OpenSessionInViewFilter要在web.xml文件中配置 阅读全文
posted @ 2011-12-26 21:05 tazi 阅读(139) 评论(0) 推荐(0) 编辑