|
Re: [Teneo] Abstract classes in top entities [message #113064 is a reply to message #113043] |
Sun, 24 February 2008 10:02 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi André,
I see your point. The problem is effectively a bit larger, in fact any superclass which is
non-contained which has contained-sub-classes will result in instances of contained-sub-classes to
be loaded in the resource. However this more general issue is hard to solve and the
hibernateresource load behavior can be customized
( http://www.elver.org/hibernate/hibernateresources.html#Custo mizing+load+behavior).
But for the case you mention (abstract superclasses) I agree that the topentities computation should
not consider abstract superclasses as topentities. It should just look at concrete subclasses.
Can you enter a bugzilla for this with just a copy of your post in it? Then I will incorporate this
in the next build (within a few weeks from now).
gr. Martin
André Lahs wrote:
> Hi,
>
> 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.
>
> With regards, André
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: [Teneo] Abstract classes in top entities [message #615547 is a reply to message #113043] |
Sun, 24 February 2008 10:02 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi André,
I see your point. The problem is effectively a bit larger, in fact any superclass which is
non-contained which has contained-sub-classes will result in instances of contained-sub-classes to
be loaded in the resource. However this more general issue is hard to solve and the
hibernateresource load behavior can be customized
( http://www.elver.org/hibernate/hibernateresources.html#Custo mizing+load+behavior).
But for the case you mention (abstract superclasses) I agree that the topentities computation should
not consider abstract superclasses as topentities. It should just look at concrete subclasses.
Can you enter a bugzilla for this with just a copy of your post in it? Then I will incorporate this
in the next build (within a few weeks from now).
gr. Martin
André Lahs wrote:
> Hi,
>
> 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.
>
> With regards, André
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.02713 seconds