Great to hear you, now it works!
I declared child as datytype object.
After all I can read data out of my table. For this I use:
Code:
public class Parent{
@Any( metaColumn = @Column( name = "Type" ), fetch=FetchType.EAGER )
@AnyMetaDef(idType = "long", metaType = "string",
metaValues = {
@MetaValue(targetEntity = Section.class, value = "Section"),
@MetaValue(targetEntity = Part.class, value = "Part")
@MetaValue(targetEntity = Lang.class, value = "Lang")
})
@JoinColumn( name = "RefID" )
private Object obj_Object;
...
}
So I can get table "Parent" with columns and "obj_Object".
Code:
Query query = session.createQuery("select l from Parent l");
ArrayList objects = (ArrayList)query.list();
The "obj_Object" shows me the belonging table (e.g. Section) with columns. But entry of the columns is empty, for every "obj_Object".
Relation between tables with RefId is ok.
I can figured out SectionId with this code. That works! SectionId is reloading out of database.
Code:
Parent test = (Parent ) objects.get(0);
Section test2= (Section) test.getObj_Object();
test2.getSectionId();
This seems behaviour of lazy-lodaing. First table "Parent" is loading and then (when needed) sub-table with entries is loading. But I use "fetch=FetchType.EAGER". When I try "fetch=FetchType.LAZY" it´s same behaviour.
What do I wrong?
I want to load table "Parent" and all subtables with entities at one time. I want to load eager not lazy!!
How can I do this?
THX in advance.