java - Use an object stored in objectdb file without having it's class definition -
let's create object in java named point 2 attributes (int x & int y) , store instances in objectdb file. know how retrieve items (as objects) file how can access attributes if don't have definition of class point anymore?
point definition
class point { int x; int y; }
then create 2 points (0,0) (1,1) , store them in objectdb file (i can provide code if needed)
i retrieve point instances statement
typedquery<object> query = em.createquery("select o object o", object.class); list<object> results = query.getresultlist();
supposedly have objectdb file , not point class definition how can values of x , y (even simple string values)?
thanks in advance
when class definition missing objectdb automatically generates synthetic class according class schema stored in database. therefore query in example returns instances of synthetic point class generated objectdb.
you can access data using java reflection api (possibly using jpa metamodel api).
Comments
Post a Comment