#I don't want to call the table if there is no new transaction done on the table.

11 messages · Page 1 of 1 (latest)

serene salmon
#

I am calling a db table to fetch records, and I don't want to call the table if there is no new transaction (insert/update/delete) done. I am using JPA to handle database.

Tools: Java 8, JPA, Postgresql.

Could anyone please tell me, how can I achieve it?
/help

fringe veldtBOT
#

This post has been reserved for your question.

Hey @serene salmon! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

#

<@&765578700724371486>

Requested by dynast#8412
rain salmon
#

i guess you can add a flag, when a new transaction is done this flag is true and when fetching records you set this as false, but why dont you want to call a db? seems like micro-optimization @serene salmon

serene salmon
#

@rain salmonflag is one way to achieve this. I am looking for an alternative that I can use for any repository.
I do not want multiple call to db coz unnecessarily its calling db. lets say if there 10 requests per sec then its calling db 10 times and getting same result.

rain salmon
#

wouldnt a cache help in this case?

serene salmon
#

It can.

rain salmon
#

look into hibernate second level cache

#

@serene salmon

serene salmon
#

Okay sure, Thanks.