Hi,
in my view, thats not the job of a database-request. Instead its a matter of your OOP-Design.
I thought, even Java has basic OOP-Support.
So why do you not assign the retrieved Class to the proper Java-Object?
I have done this for ruby. There its just a matter of two lines of code:
def self.orientdb_class name
klass = Class.new( self )
name = name.to_s.camelize
if self.send :const_defined?, name
self.send :const_get, name # returns the Const
else
self.send :const_set , name , klass # creates and returns the Const
end
end
Elsewhere you simply define the Class in the usual way. Everytime a Database-object is fetched, I call BaseClass.orientdb_class( vertex_name ) and get the proper Ruby-class.
The ruby-class knows about its parents and has the proper methods to deal with the fetched content.
Take a look at ActiveOrient
Maybe its not that simple in Java, but as Jruby exists, somehow it must work.