2014年9月3日

(转)ManyToMany注解

摘要: @ManyToMany注释:表示此类是多对多关系的一边,mappedBy 属性定义了此类为双向关系的维护端,注意:mappedBy 属性的值为此关系的另一端的属性名。例如,在Student类中有如下方法:被控方:@ManyToMany(fetch = FetchType.LAZY, mappedBy... 阅读全文

posted @ 2014-09-03 10:17 Ranger0526 阅读(9538) 评论(1) 推荐(0) 编辑

Spring 注解@Transactional

摘要: 1.@Transactional 用于开启事务。2. 由于注解是可以继承的,所以如果在父类上添加了改注解,在子类也同样有效。3.但是如果是在子类上注解的话,在父类上的方法不会被开启事务。写在方法上: 对本方法有效写在类上: 对本类中所有public方法有效 对子类的中方法有效 对父类声明的方... 阅读全文

posted @ 2014-09-03 10:14 Ranger0526 阅读(268) 评论(0) 推荐(0) 编辑

2014年9月2日

Spring DelegatingFilterProxy解析

摘要: 以前DelegatingFilterProxy是在需要使用spring security 的时候在xml中配置,如下: springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springS... 阅读全文

posted @ 2014-09-02 18:16 Ranger0526 阅读(2820) 评论(0) 推荐(1) 编辑

Merge使用

摘要: Role r = new Role();r.setName("TEST");r.setDescription("123");r.setLevel(2);roleServices.merge(r);System.out.println(r.getId());上面代码执行完以后,r.getId()是nu... 阅读全文

posted @ 2014-09-02 14:18 Ranger0526 阅读(143) 评论(0) 推荐(0) 编辑

EntityManager 实例化方法

摘要: Configure the EntityManager via a persistence.xml file movieDatabase movieDatabaseUnmanaged org.superbiz.injection.jpa.Movie ... 阅读全文

posted @ 2014-09-02 10:30 Ranger0526 阅读(1232) 评论(0) 推荐(0) 编辑

Java Jpa 规范

摘要: Jpa最早是EJB3.0里面的内容,JSR 220: Enterprise JavaBeansTM3.0https://www.jcp.org/en/jsr/detail?id=220后来大约在09年提出了JPA2.0的规范:JSR317https://www.jcp.org/en/jsr/deta... 阅读全文

posted @ 2014-09-02 10:09 Ranger0526 阅读(646) 评论(0) 推荐(0) 编辑

2014年8月26日

Spring HandlerInterceptor

摘要: 1.SpringHandlerInterceptor 可以组成一个chain。这个接口有三个方法:public interface HandlerInterceptor { /** * Intercept the execution of a handler. Called after... 阅读全文

posted @ 2014-08-26 14:29 Ranger0526 阅读(568) 评论(0) 推荐(0) 编辑

2014年8月24日

Spring data jpa

摘要: 1. Spring data jpa怎么去判断一个对象的是否为新对象呢?spring data 提供了三种策略:able2.2.Options for detection whether an entity is new in Spring Data JPAId-Property inspectio... 阅读全文

posted @ 2014-08-24 08:27 Ranger0526 阅读(560) 评论(0) 推荐(0) 编辑

2014年8月15日

Spring Security @PreAuthorize 拦截无效

摘要: 1. 在使用spring security的时候使用注解,@PreAuthorize("hasAnyRole('ROLE_Admin')")放在对方法的访问权限进行控制失效,其中配置如:@Configuration@EnableWebSecuritypublic class SecurityConf... 阅读全文

posted @ 2014-08-15 10:31 Ranger0526 阅读(17085) 评论(0) 推荐(0) 编辑

2014年8月14日

Java ee el表达式

摘要: 以前在开发的时候,偶尔会遇到jsp页面不支持el表达式的情况。这个的原因是因为El功能被关闭了,当时的解决办法是关闭忽略。isELIgnored 设设置但是为什么有时候不用设置也可以了呢。发现原来是和web.xml的声明有关系。有些版本的servlet声明默认就是关闭的。貌似在2.4以前的都需要加上 阅读全文

posted @ 2014-08-14 06:24 Ranger0526 阅读(302) 评论(0) 推荐(0) 编辑

导航