Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and database data modifications

 
Andrei Antonescu
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am currently working with Hibernate and Sql Server 2008. The question is if the webapp is running and I am modifying the data in the tables of the database (tables that Hibernate mapped to objects in my webapp) will that influence Hibernate in any way ?
Will it crash ?


Thanks in advance,
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it out and let us know if it crashes or not.
 
Bogdan Baraila
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IF you modify only the data hibernate will not crush but it's possible that your modified data to be overrwritten if same objects (rows) were loaded into you webapps. If you modify your database structure then it is possible to receive errors for the modified table (for example if you delete a table or a column mapped in hibernate; adding tables, columns etc. is ok).
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it would be a a problem if you add a column with a not null constraint and try to add data to the table with hibernate though.
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know much about Hibernate, but I suspect you might have problems with transaction locking or cached data if you're updating the DB in the background while your Hibernate application is running as well. You'd probably need to test the various scenarios to make sure things work the way you want/expect them to.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic