Your problem is that PropertyBase<T>
is an entity with field value
being persistable. Your database needs to map that field type to a column type, and you have three entities that have different java types for the same field: PropertyBase<T>
is generic and has itself no idea what type its value
field is, StringProperty
says it is a String and ShortProperty
says that is a Short. So that is a conflict.
In order to overcome this problem, you make field value
transient, and for every subtype of PropertyBase<T>
(like StringProperty
) you can define a new persitable property with different names, eg.
StringProperty
will have a private String stringValue
, ShortProperty
will have a private Short shortValue
, and every field will be mapped to different DB column.
PS: I cannot explain why it works when you make all the classes static inner
.