Update counter in a table from Hibernate

we have a requirement to increment a counter in the database tables from a java program. There can be multiple java processes incrementing the counter. How can we make sure that the counter is incremented correctly, so that there are no dirty reads by the processes and increment on a stale value.

using Hibermate mapping to that table.

Note: this is not the ID column.
dhumaAsked:
Who is Participating?
 
Sharon SethCommented:
Bad idea incrementing DB counters from client side . This should be actually done on the DB side
0
 
dhumaAuthor Commented:
this is the counter we use on how many messages were processed by the client programs.
0
 
dhumaAuthor Commented:
is there a way to acheieve this from hibernate ?
0
 
dhumaAuthor Commented:
.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.