java - Hibernate persisting an Object member -
is there way persist entity member of type java.lang.object ?
lets have entity dynamicproperty has members
private string name; private object value;
value can of several types non complex ones (string, boolean, integer, decimal, enum...)
is there way doing ? , db(oracle) column type should .
if they're basic types, can try store them strings , cast them right classes in getter.
there's option - can create class hold value type , have fields of necessary types, 1 being set though. like
class foo { integer a; double b; string c; int type; //getters , setters public object getobject() { if (type == 1) return a; else if (type == 2) return b; return c; } }
it's bit of workaround, should work. think isn't possible persist object abstract.
also, take @ @embedded
annotation, may help.
Comments
Post a Comment