Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[Teneo] Abstract classes in top entities
https://www.eclipse.org/forums/index.php/mv/msg/193619/615546/#msg_615546
I am currently investigating Teneo with Hibernate. Especially the lazy
loading possibilities are very interesting for me.
My meta model is quite simple. There is a model class which contains
packages and packages can also contain packages. Both model and package
classes extend an abstract class namedElement. On resource loading I
expected the containment references to be lazily loaded.
While testing I noticed that all objects (model and packages) were loaded
on initial resource loading. First, I thought it was an configuration
issue. But it wasn't. I debugged the HibernateResource and found out, that
it loads all "topEntities" at once. The problem is, that all objects of
type namedElement where recognized as topEntities, since namedElements are
not contained by any other class. For this reason all packages where
loaded immediately.
After changing the computeTopEntities() method of HbDataStore class, it
worked the expected way.
protected String[] computeTopEntities() {
final ArrayList<String> result = new ArrayList<String>();
for (Iterator<?> pcs = getClassMappings(); pcs.hasNext();) {
final PersistentClass pc = (PersistentClass) pcs.next();
...
if (topEntity && !pc.isAbstract()) { // added not abstract condition
result.add(getMappedName(pc));
}
}
return result.toArray(new String[result.size()]);
}
Is there another possibility to control the topEntities computation?
Are there any drawbacks with the solution above? Otherwise I would
suggest, that this becomes the default behavior.