Eelco Hillenius,
But another problem occurs ... When I submit a form, it works, but when
i upload a file, the annoying LazyInitializationException jump out
======= 2005-06-17 22:42:47 :=======
>Good. Problems with Hibernate was the main reason for us to implement it
>in the first place, and REDIRECT_TO_BUFFER (currently the default) is
>more efficient.
>
>Eelco
>.
>
>叶卫国 wrote:
>
>>Eelco Hillenius,
>>
>> Yes... I use 'REDIRECT_TO_RENDER' strategy, I change it to
>> 'REDIRECT_TO_BUFFER', it' ok
>>
>> :-)
>>
>>======= 2005-06-17 21:44:11 :=======
>>
>>
>>
>>>First, when you work with Hibernate, you should work with detachable
>>>models. Any lazy loading reference you have with your hibernate objects,
>>>needs an open hibernate session, while you should return (close) the
>>>hibernate session after each request.
>>>
>>>And which render strategy do you use? The 'REDIRECT_TO_RENDER' strategy
>>>(not the default anymore) could cause problems with Hibernate session,
>>>as you might load an object in the action part of the request, and
>>>render that object in the render part (which is a seperate request). See
>>>also the javadocs in ApplicationSettings.
>>>
>>>Eelco
>>>
>>>
>>>叶卫国 wrote:
>>>
>>>
>>>
>>>>Caused by: org.hibernate.LazyInitializationException: could not initialize
>>>>proxy - the owning Session was closed
>>>>
>>>>
>>>>I use wicket+spring+hibernate. this is the code snippet:
>>>>
>>>>public class NewsDAOHibernate extends HibernateDaoSupport implements
>>>>NewsDAO {
>>>>
>>>> public void add(News news) {
>>>> super.getHibernateTemplate().save(news);
>>>> }
>>>>
>>>> public void update(News news) {
>>>> super.getHibernateTemplate().update(news);
>>>> }
>>>>
>>>> public void delete(News news) {
>>>> super.getHibernateTemplate().delete(news);
>>>> }
>>>>
>>>> public News fetch(Long newsId) {
>>>> return (News) super.getHibernateTemplate().load(News.class, newsId);
>>>> }
>>>>
>>>> public List findByAll() {
>>>> String hsql = "from News";
>>>> return super.getHibernateTemplate().find(hsql);
>>>> }
>>>>
>>>> public List findByShop(Shop shop) {
>>>> String hsql = "from News as news where news.shop = ?";
>>>> return super.getHibernateTemplate().find(hsql, shop);
>>>> }
>>>>
>>>>}
>>>>
>>>>
>>>>
>>>> 2005-06-17
>>>>HS^甸?X??'????(疥????j亘?+kj??????"?^??Z0F??l糙?m~?j????"?+?b藉?片镀?j+xg?鳙守b?
>>>>
>>>>
>>>êw??
>>>z郓?)y?j?囤?l⑶gr?i?卷?∪?^?)?E?G?谦??x%?V?峨???(悍~?zw????????玷??咤?l??)撸?"rG?谦
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>>>
>>>
>>>from IBM. Find simple to follow Roadmaps, straightforward articles,
>>
>>
>>>informative Webcasts and more! Get everything you need to get up to
>>>speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
>>>_______________________________________________
>>>Wicket-user mailing list
>>>[email protected]
>>>https://lists.sourceforge.net/lists/listinfo/wicket-user
>>>
>>>
>
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>from IBM. Find simple to follow Roadmaps, straightforward articles,
>informative Webcasts and more! Get everything you need to get up to
>speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
>_______________________________________________
>Wicket-user mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/wicket-user
= = = = = = = = = = = = = = = = = = = =
叶卫国
[EMAIL PROTECTED]
2005-06-17