8

I implemented database querying for a table using jpa. I have added a new column in database for the table and completed my coding.

If after some time the deployment got reverted, consider I added a activeFlag column and it needs to be removed from my code later, will the previous version of the deployment work? i.e., it will have an entityClass for the table without the activeFlag but the data base will have it, and there will be no mapping defined to the activeFalg column in database in the generated entity class.

Will that be fine?

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
kjkszpj
  • 81
  • 1
  • 1
  • 4

2 Answers2

8

If you have a table mapped to a JPA entity where there are columns that aren't getting mapped, those will be ignored by the JPA code. Having an unmapped column isn't going to break anything.

Simeon Leyzerzon
  • 18,658
  • 9
  • 54
  • 82
Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
4

This will work unless you do not have any constraints which prevent the data from getting inserted into the table. We have a similar setup where we use 2 version of application pointing to a common database. Of-course if you use it only for querying purpose then it should be fine.

Karthik
  • 1,005
  • 8
  • 7