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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -