- 博客(11)
- 资源 (2)
- 收藏
- 关注
原创 hibernate 乐观锁&悲观锁
hibernate乐观锁 就是在数据库中增加一个字段例如version 每一次修改数据的时候,都会修改version的值,所以,同时修改数据的时候并不会成功,同时会抛出一个org.hibernate.StaleObjectStateException异常。这个时候可以捕获这个异常然后,重新修改值,就可以了。 示例:@Entity@Table(name = "t_user")public c
2017-03-16 20:06:33 265
原创 hibernate service
hibernate service中跟dao并无太大区别。 写了一个简单的BaseServicepublic interface IBaseService<DAO extends IBaseDao<T>, T> { public void save(T t); public T getById(Long id); public void update(T t); p
2017-03-14 20:16:24 589
原创 spring&hibernate(01-简单构建)
pom.xml<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId></depe
2017-03-13 20:20:33 322
原创 一个简单的基于spring jdbc的扩展
今天试了一下用spring的jdbcTemplate来增删改查的功能,感觉还是挺麻烦的,于是就扩展了一下,代码比较凌乱,见谅。 原来的UserDao:@Resourceprivate JdbcTemplate jdbcTemplate;@Overridepublic void save(User t) { if(t == null) return ; this.jdbcTemp
2017-03-12 22:01:22 420
原创 spring jdbc之query
直接上代码public class User { private Long id; private String username; private String password;beans.xml<context:property-placeholder location="classpath:settings.properties" /><!-- 查看对应的配置 -->
2017-03-12 12:06:36 592
原创 aop with annotation
@Aspectpublic class AopMethod { @Pointcut("execution(* com.xxx.spring.aop.service.SomeServiceWithNoInterface.*(..))") public void pointCut() { } public void before() { System.o
2017-03-11 09:27:13 291
原创 spring aop xml实例
pom.xml<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId></depe
2017-03-11 09:07:34 255
原创 spring bean创建
spring bean 方法1:<bean id="stu1" class="aa.xxx.chapter01.Student"> <constructor-arg index="0" value="1"/> <constructor-arg index="1" value="小明"/></bean><bean id="stu2" class="aa.xxx.chapter01
2017-03-10 09:39:47 293
原创 spring基础说明01-schema
一个简单的配置<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://w
2017-03-09 12:41:09 321
转载 文章标题
idea创建Maven项目慢的问题解决方法:settings->Build, Ex...->Build Tools->Maven->Runner-DarchetypeCatalog=internal
2017-03-09 09:16:08 192
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人