One way is to use READ_ONLY
transactions by putting @Transactional(readOnly=true)
in the method.
http://www.codeinstructions.com/2009/04/read-only-transactions-with-spring-and.html
.
Another method. Regarding isolation levels, if your table has never been inserted or updated, you can use the READ_UNCOMMITTED isolation level, which allows you to read dirty reads, irreproducible readings, and phantom. However, none of this matters since the data never changes.
You can see the different isolation levels and the effects of each in spring javadocs ( http://docs.huihoo.com/javadoc/spring/2.5/org/springframework/transaction/annotation/Isolation.html
)
This will free the line locks the most and give you better performance, at least until the lock goes
source share