Summary on 2008-06-12: How to check one session is valid

本文探讨了在使用Hibernate框架进行对象关系映射时,如何处理Set集合的级联操作流程,以及在无效化Session前验证其有效性的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. before invalidate the session, it's necessary to check whether the session is still valid,

HttpServletRequest supply one method called: isRequestedSessionIdValid()

this method will check whether the current session is still valid, and if yes, return true, else, return false.

2. For the use of 'Set' in hibernate.

if one POJO has one set and the cascade has been set to 'true' in the hibernate mapping file

so for one POJO, let's say, there is instance O1 and O2 in the set. while in usage, if we reset the 'Set' with one new set, and add O1 and O2 into the set, and save/update the POJO. what's the process of save the set? you should be surprised to see the process is that: 1. delete O1 and O2 from db 2. save O1 and O2 to db.

so that's the process of handling the 'Set' in hibernate.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值