Search code examples
hibernatereal-timebatch-processingproduction

Using hibernate in real time


Now i have finished my database model using hibernate and java POJO classes. Now I want to use my database in real time.

I saw any articles saying that we should not count on hibernate.bm2ddl.update in production and we should use manual batches.

  • what should i do now?
  • what are these batches?
  • what should i do regarding hibernate after i finish my model to start using it in real time?

I alreay tried update an validate but it take tie wen talking to the databae


Solution

  • what are these batches?

    These are basically some SQL scripts containing DDL or DML instructions to update the database in a safe manner. E.g. how would you go about adding a column to a table on production? You can't simply drop table and create it from scratch with an extra column. You need to have something like : ALTER TABLE tab ADD COLUMN new_col int

    what should i do regarding hibernate after i finish my model to start using it in real time?

    Remove hibernate.bm2ddl.update from your production configuration and you should be all good.

    I would recommend not using this option for development as well to force developers to create needed scripts so that they can later be used to update production database.