I have a mapped super class, which has a field that some of the tables in my DB share.
I wish to annotate this field with @Transient so most entities will ignore it, but de-@Transient or un-@Transient it on child entities.
Is this possible?
Thank you, Idob
You might be able to use the discriminator pattern
http://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/mapping.html
You would have to set up a parent super class and then sub-class it, something like
ClassWithSharedFields
ClassExtensionThatUpdatesCertainFields
ClassExtensionThatReadsCertainFields
Then, ClassExtensionThatReadsCertainFields
could specify the field that you don't intend on updating as read only.
This might be a bit of a vague suggestion, so if you want more specific help maybe provide some more concrete examples of how your domain classes need to behave in relationship to your DB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With