Monday, 4 June 2012

Hibernate 4.1.1 will create the column if we misspelled in the annotation

If we misspelled the column name in the annotation, then hibernate will create that column automatically. I don’t know whether we can turn this feature off.

Steps to Reproduce

  1. Setup the environment as said here.
  2. Now go back to patient.java and change @Column(name="firstname") to @Column(name="firtname")
  3. Now run the test java file.
  4. You can see, it will run successfully without any error.
  5. And now go back to db. and if you check the patient table, now you can see one more column added and null inserted for all the records

No comments:

Post a Comment