Hi
I have put my answer in below you mail
/Flemming
On 6/23/07, Robert . <[EMAIL PROTECTED]> wrote:
Hi, I'm trying to make a project using Hibernate, Spring and Wicket.
I am have some conceptual difficulties. Would love if someone could
share their knowledge or point me in the right direction.
I will try.
One thing I am struggling with is where I should put my DAO's and data
services. I know about the @SpringBean annotation for components, but
how should I use those in classes such as DetachableXXXModel? Should
I pass the DAO's I need to that class or should I put DAO's in the
application object (like Pro Wicket examples do)?
There is no silverbullet here. Each solution has its drawbacks. However the
solution I have come to best like is only using the @SpringBean in pages,
and then pass on the springbean as argument to where every it is needed.
That way it is also more clearly seen in the page where the service is used.
Is there a good Wicket example project I can look at, besides phonebook,
that uses Spring and Hibernate? I am interested in the right set-up.
You could also look at the Databinder project. It includes some nice
examples too.
I also have some questions about OpenSessionInViewFilter, which probably
are off-topic, but hope someone wants to help anyway.
There seems to be quite some disagreements about whether using
OpenSessionInViewFilter is a good thing or not. What does the Wicket
team/users
think about it?
I have also used OSIVF on a project. And you really have to be carefull
here. Hibernate has some nasty exceptions that easily will be thrown at you.
Especially Lazyexception session closed or... object with same id is already
loaded in session
I came to the conclusion that is was much easier to copy you hibernate
objects into viewbeans which is designed with wicket in mind. So above the
service layer you have view bean. And under the service layer you have
hibernateobjects (domain objects). I would be happy to hear others comments
on this one.
If I understand correctly, and please correct me if I'm wrong,
by using the OpenSessionInViewFilter you get a new transaction at the
start
of every request, which commits or rollbacks at the end.
This is so that lazy associations, which are accessed outside explicit
transactions,
such as in Wicket Page classes, are initialized and don't throw an
exception.
So what kind of transaction exactly is created by the
OpenSessionInViewFilter?
(propagation, isolation?)
Can I use it only for reading?
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user