I would use one hibernate session,
That i would start when the request comes in (see hibernate examples for that by using youre own WebRequestCycle, see Cdapp for this)

Then when that session is used is is up to the render configuration you have configured:

With ONE_PASS_RENDER or REDIRECT_TO_BUFFER you will reuse that hibernate session for loading the action phase (calling the listener and loading the models that the listener is needed) and the render phase (loading all other models that are needed for rendering)

if you use REDIRECT_TO_RENDER then 2 times a Hibernate session will be opened one for calling the listener phase and one for the render phase.

REDIRECT_TO_BUFFER is the default and if you don't have non sticky cluster structure over youre servers then this will be the best option.

Opening a transaction over the complete request looks to me like a bit to much. Why not opening it over the parts you want?
I think having the render phase in a transaction is a bit overkill.

johan


Peter Veentjer - Anchor Men wrote:
I don’t see how using Wicket as opposed to Maverick/MVC different with respect 
to transactions?

---------------------------------------------

It had to do with the facts I didn`t know what happened if I had a session 
without a transaction. I though every session should have a transaction.. So my 
question was how many you needed..  And I know now.. Just a single transaction 
about the part that could change the model. The part where the model is 
reattached and maybe other parts don`t need to be protected by a transaction 
anymore... So I have the answer I need.


-Igor
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Phil Kulak
Sent: Monday, August 01, 2005 8:14 AM
To: [email protected]
Subject: Re: [Wicket-user] Hibernate and Transactions (again)

If you're doing non-critical stuff, you don't need to worry about transactions. If you do need transactions, you can use container managed (JTA), or application managed (probably Spring). That way, you mark certain methods as transactional and the container or Spring takes care of opening the transaction at the beginning then committing at the end or rolling back in case of a RuntimeException.

On 8/1/05, Peter Veentjer - Anchor Men <[EMAIL PROTECTED]> wrote:
I didn`t mean that. I wanted to know how many transaction where required and I didn`t know what happened if you use a
session without
a transaction. I just heard that if you used a session without a transaction the default isolation level is a READ_COMMITED.
And that is something I can live with.
So it boils down to: the only part you need a transaction is around the event handler (if you don`t need a seperate service layer). And this makes our thinking a hell of a lot easier :) ________________________________
 Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens
Igor Vaynberg
Verzonden: maandag 1 augustus 2005 16:43
Aan: [email protected]
Onderwerp: RE: [Wicket-user] Hibernate and Transactions (again)

You use JTA transactions, that way different services can
join in on
the transaction. You open a JTA transaction in the beginning of the request, all your services/daos use that transaction, and
at the end
of the request you either commit or roll back.
-Igor ________________________________
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Veentjer - Anchor Men
Sent: Monday, August 01, 2005 7:30 AM
To: [email protected]
Subject: [Wicket-user] Hibernate and Transactions (again)

I have another question about the length of a Hibernate transaction and wicket. Normally you have a request->the model is re-attched->method call (maybe go to some service to do some saves) -> render view. How do you coordinate the transaction that is to re-attach
the model?
If you have a service, the service probably has his own
transaction,
but the reattachement needs his own transaction also. A
Session that
isn`t protected by some kind of transaction to do reads from the database could give some strange results. How do you deal with this? And what if you don`t need a service, but you have a form, and the data in the form is valid and can be submitted directly to a dao (a seperate service layer for very-small application is imho quite useless). Do you work with a single transaction to do the reattachement and the same transaction for the dao.save. Or
do you make different transactions?
And what if a page activates another page? The other page his model must be reattached (so it needs a session/transaction).
Where does he
get het transaction from? Do you make a big transaction for the complete request so that everybody has a good transaction
they can use?
As you can see there are a lot of questions about how to
use Hibernate
with something like wicket and we want to understand how to
deal with
these situations so we can help other programmers at our company as soon as we switch from maverick to Wicket/Tapestry (Wicket has the most chance btw). I hope somebody can answer my questions. Met vriendelijke groet,

Peter Veentjer
Anchor Men Interactive Solutions – duidelijk in zakelijke internetoplossingen

Praediniussingel 41
9711 AE Groningen

T: 050-3115222
F: 050-5891696
E: [EMAIL PROTECTED]
I : www.anchormen.nl

HµŠ²²uнjŠ2jj‰®š¶–F™²Š~j®•™½m¶vxzÊžºvz¶yj¶ý¢rií¡÷rrº™ŠŠ
‰¶®¶º~z†³Š²q®zŠþ¶£rº




-------------------------------------------------------
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_idt77&alloc_id492&op=ick
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user



HS^�隊X���'���u����(���j̋�{�2(+jب�+kjנ������b��"��^���Z0F����l��ڊm~��j�Z�؜��"��+��b��mƬ�Ƨvj+xg�z���b�
��w�v� 
z۩��)y�_j�a���l��gr��i؝��e�ȝ^�j)�rE�rG��ǫ����x%��V�����X���(��~��zw���i����l���q���z���l�X��)ߣ�"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

Reply via email to