Transaction Management with StatelessSession in Hibernation

I have a problem using StatelessSession

and ScrollableResults

in spring application with hibernate. I have several DAOs, mostly using a shared session object, but for one purpose I need to iterate over the whole table. I found out that it is efficient to do this ScrollableResults

to iterate over objects and StatelessSession

not store any results attached in memory. However, I need to do this iteration outside of the DAO because the information from the DB is used to access the external API. So I created methods to create and closeStatelessSession

from the DAO side. I wonder how in this case I should manage the transactions? It seems that transactions are not needed at all (data is only read), but when checking the code, I was told that a transaction can be created automatically and never closed by spring Hibernate Transaction Manager. So should it be manually overloaded or would it be a useless precaution?

+3
java spring hibernate transactions


source to share


No one has answered this question yet

Check out similar questions:

996
What are the possible Hibernate hbm2ddl.auto config values ​​and what do they do
636
What's the difference between JPA and Hibernate?
429
Where does the @Transactional annotation belong?
81
Hibernate lazy load application design
3
How to manage 2 DAO methods in one transaction in Java Spring and Hibernate?
3
Transaction management with Spring, Hibernate and mySQL
1
Hibernate session closed in spring of transaction after method call a second time
1
Spring hibernation scenario
1
EJB, Hibernate and Spring Transaction
0
DAB downgrade security



All Articles
Loading...
X
Show
Funny
Dev
Pics