Today's Hibernate Lesson
Dec. 1st, 2008 10:33 pmSo for today's hard knocks hibernate lesson we learn that putting annotations on Member variables instead of Member Functions is a really bad idea. It breaks when you use inheritance. If you inherit from a MappedSuperclass and that superclass has members that are complex objects, then when you inherit them, all the annotations are ignored in the subclass, so you end up with database fields being of type bytea (at least in PostgreSQL) instead of being correctly mapped as foreign keys.
So in summary: Don't put annotations on member variables, always put them on member functions.
*SIGH* time to refactor 32 database classes.
At least I found the problem quickly.
So in summary: Don't put annotations on member variables, always put them on member functions.
*SIGH* time to refactor 32 database classes.
At least I found the problem quickly.