I made several calls to JDBC which spread over a couple of modules.
I wonder, if say the power breaks down, the database will
be in a inconsistent state, How can I ensure this won't happen,
Do I delay the commit to the very last minute?
The databases (except perhaps the most simple ones, such as MS Access) are designed to protect the data even in case of system failure or power outage. If this happens, the database does what is necessary to get into consistent state after next startup. Everything what was committed is guaranteed to be there, and everything what wasn't committed gets cleaned up.
More advanced databases can usually be even configured to provide protection agains media failure, situation where your hard disk fails. This usually requires some more configuration and doesn't work out of the box automatically. If you were interested into this kind of protection, your best bet would be to consult your database documentation.
And as a general rule you should commit your transactions as soon as possible, rather than delaying the commit as long as possible. Uncommitted transactions may lead to problems with other applications which are trying to use the same data, and this is a far more likely possibility than a power failure.
Onion rings are vegetable donuts. Taste this tiny ad: