I have a few 'base types' in my model, for example 'Entity', which hold properties that are common to all entities, for example 'id'. If the column names of such properties were all the same (if, for example, all my PKs were named 'ID'), then I could just throw an @Id on the property in the base type and all would be well. However, this is not the case. The base type properties actually differ in name based on their table (for example TABLE_ID, TABLE_NAME, TABLE_DESC, etc), so it is not possible to map them in the base type using a single @Column(). I can get around this by annotating the properties in the base types with @Transient then copying/pasting the getter into the concrete type and annotating with @Column() there, but that's lame.
Is there any way to 'override' annotations, or cause them to compute the name parameter dynamically, or something else which could allow me to map this in an elegant way?
By the way, I want to say that I'm really digging this annotation stuff. Even if I do end up having to do this the hard way, it's a lot better than XML or Xdoclet. In a way I'm almost glad I'm having this problem. I could just as easily be having problems with straight JDBC data access code, and those are much less entertaining. I love hibernate <3 *sniff*
|