Three-tiered tiered application using Wicket + Spring + Hibernate. How would you handle transactions?

I'm thinking of using the Open In Session Filter (OSIV) filter or the sniffer that comes with Spring, since it seems convenient to me as a developer. If you recommend, do you recommend using a filter or interceptor and why?

I am also interested in how it will mix with HibernateTemplate , and if I lose the ability to mark methods as @Transactional (readOnly = true) , etc. and therefore lose the opportunity to get even finer-grained transaction control?

Is there any best practice for integrating such a solution with a three-tier architecture using Hibernate and Spring (I suppose my decision to use Wicket for presentation should not make much difference)?

If I use OSIV, I will at least never go over to lazy loading errors, on the other hand, my transaction will live longer than it can commit, being uncommitted in the view.

+3
source share
2 answers

This is really a matter of personal taste.

. SOA, . 2 ( , ), 2 , .. , , .

OTOH , ( , , ..).

, , - Value . VO. ( , ), , ...

: , , , , . ( SOA-, , ,...). - LazyLoadingExceptions, VO. VO - , , , , DRY. VO, , VO - . , . , : , , .

+4

OSIV, , ,

, LazyInitializationException, , , LIE

+2

Source: https://habr.com/ru/post/1702959/


All Articles