0
  1. I have a table with AlternateBillingEmail column - historical issue
  2. I have set up an ImprovedNamingStrategy in my annotation configuration - many tables are ok
  3. I have added a @Column(name="AlternateBillingEmail") on a field in entity

Result - @Column ignored, I can see alternate_billing_email in hibernate logs, but If I put it on a getter method, it works? Why?

rtruszk
  • 3,902
  • 13
  • 36
  • 53
avalon
  • 2,231
  • 3
  • 24
  • 49
  • There are several posts for that (or similar) case, for example http://stackoverflow.com/questions/594597/hibernate-annotations-which-is-better-field-or-property-access – michaldo Apr 26 '15 at 21:33
  • "utspring" ? what? that aside, nobody sees your class so cannot know the context of your Column annotation – Neil Stockton Apr 27 '15 at 07:24
  • Show ur mapping on POJO to get proper solution. Add some code snippet to question for better understanding. – OO7 Apr 27 '15 at 08:34

1 Answers1

0

So, if you need simple and convenient code, use annotation on a field, if you need more complicated logic, use it on getter method. Spring recommends to use field method, but in practice I would use getter way.

avalon
  • 2,231
  • 3
  • 24
  • 49