我班的层次结构是这样无法如果与弹簧AuthenticationProcessingFilter扩展类坚持实体JPA
public class AccessHistoryJpaDAO extends PaginatedJpaDAO<AccessHistory, Long>
implements AccessHistoryDAO
在AccessHistoryJpaDAO
我实现了这是在AccessHistoryDAO接口中声明登录方法。
public void logIn(AccessHistory entity) throws DAOException
{
super.save(entity);
}
然后,我在此方法扩展春天AuthenticationProcessingFilter
和重写的方法
@Override
public Authentication attemptAuthentication(HttpServletRequest request)
throws AuthenticationException
的
公共类CustomAuthenticatingFilter扩展AuthenticationProcessingFilter当我打电话
getAccessHistoryDAO().logIn(entity);
Hibernate是不能坚持的实体,而是 当我打电话照片直接
getAccessHistoryDAO().save(entity)
以上方法是坚持实体,以及我揣摩出来,但没有任何线索,任何帮助将不胜感激。谢谢。
有一件事我忘记了,没有任何异常或奇怪的行为,这是hibernate n表示成功插入但是表中没有行的id的实体。但是,只要我调用getAccessHistoryDAO()。save(entity),表中就有一行。 – 2012-04-17 09:44:33
它是否抛出任何异常或实体只是不持久? – sinuhepop 2012-04-17 10:28:12
在Ralph提到的这种情况下,不会有任何异常,但hibernate不会启动事务处理,因此数据库中不会插入任何记录 – 2012-04-17 12:07:46