Hi!
I'm working with the newest hibernate release.
Consider the following class:
Code:
@Embeddable
public class MyClass {
@Type(type="one_of_my_user_types")
@Colum(colum = "my_column")
private String aField;
....
}
Exists there a way to override the type of "aField" in clients of this class (like overriding the column-Attribute with @AttibuteOverrides)? If there exists no solution with annotations, exist there a solution with hibernate mapping files?
The only solution which comes up to my mind is to build severall (in my case: 2) sublasses of MyClass which extends one BaseClass. The base class doesn't have a attribute aField. This attribute is declared in the subclasses with different types:
Code:
public abstract class BaseClass {
//common fields
}
@Embeddable
public class MyClass1 extends BaseClass {
@Type(type="one_of_my_user_types")
@Colum(colum = "my_column")
private String aField;
....
}
@Embeddable
public class MyClass2 extends BaseClass {
//here we use the standard hibernate type
@Colum(colum = "my_column")
private String aField;
....
}
Hopefully there exists a better solution
Hoeft