tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radhakrishna Kalyan <>
Subject question around entityManager.flush
Date Mon, 19 May 2014 06:15:40 GMT

I have question around entityManager.flush().
Is it ok to call multiple times? Or will there be any performance issue.

My case is, I have a timer service which executes periodically where I
create a database entity using a dao object using entityManager.persist(),
after that I also  call entityManager.flush().

The reason to do so is, if database commit fails due to certain reason like
unique constrain exception then I want the timer service to send a JMS

If I don't call entityManager.flush() then I am not able to catch any
exception in my timer service thus fails to send any JMS message.

However at the end the database entity is never created which is correct.
But if I can't able to send the JMS message upon exception then I does not
meet the requirement.

Any ideas or recommendations to do it in a better way

Thanks and Regards
N Radhakrishna Kalyan

P:  +46 733 312 584

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message