2008-05-18

我的 hibernate 级联插入

关键字: hibernate
我做一个网上书城的项目,用户下订单要用两张表完成,ws_order,ws_orderItem ws_orderItem通过外键关联第一张表的主键。     表的映射文件关键部分如下: WsOrder.hbm.xml:    <set name="wsOrderItems" inverse="false" cascade="all">             <key>     &nb ...
  • 10:44
  • 浏览 (221)
  • 评论 (0)
2008-05-14

Acegi得到当前用户

关键字: acegi
在Spring容器里创建一个Bean来获取当前用户的信息的时候,该FactoryBean的主方法如下: @Override public Object getObject() throws Exception { SecurityContext ctx = SecurityContextHolder.getContext(); Authentication auth = ctx.getAuthentication(); if(auth!=null) wsUser=userDaoInter.findById(auth.getName()); else wsU ...
Hibernate的延迟加载技术使要在jsp页面访问数据时产生了 no session的错误, 可以在映射文件添加lazy="false" 来关掉,不过这样就使用不到延迟加载技术了,我用的是struts,所以要用Spring提供的 OpenSessionInViewFilter这个过滤器来处理。     添加后产生了另一个问题,就是OpenSessionInViewFilter找不到SessionFactory这个bean,仔细看了自己的项目有两个的IOC容器,一个是在web.xml中定义的org.springframework.web.context.Conte ...
  • 18:16
  • 浏览 (482)
  • 评论 (0)