Bernard Sirius wrote:
I forgot to mention: all this doesn't solve my problem
at all. because of the maxFetchDepth set to 1, and the
outer-join's being set to auto, I now have 7 SQL
queries generated instead of... who knows. This is for
2 entities, thus in my case the n+1 problem is
actually a (n*3)+1 problem...
ok, do not set the maxFetchDepth, since when proxies are enabled,
usually it is not needed.
don't you guys have a clue?
Again: the "lazy" attribute simply isn't there where
it should!
Summary:
- I have set maxFetchDepth, which works
- According to carlos the proxies are now set
- relationships are ok
... but where's the "lazy" attribute? Can you confirm
that the right tag is @andromda.hibernate.lazy=true?
sure it is this tagged value
I've checked in the hbm's: all the lazy="true"
attributes are on <set> tags, never on <many-to-one>
or anything else...
but it should not be used in many-to-one, please refer to
http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd, <many to
one> does not have any lazy settings.
Carlos
bernard
--- Carlos Cuenca <[EMAIL PROTECTED]> wrote:
Cache is enabled on each hbm mapping of each entity.
Carlos
Bernard Sirius wrote:
OK, the classnotFoundErrors apparently came from
the
fact that suddenly the datasource is configured in
a
separate xml applicationContext-datasource.xml. I
had
to copy/paste the datasource fragment to make it
work
again.
Here's what I have put in mda's project.xml:
<hibernateProxy>true</hibernateProxy>
<hibernateMaxFetchDepth>1</hibernateMaxFetchDepth>
that generates the following regarding hibernate in
applicationContext.xml:
<property name="hibernateProperties">
<props>
<prop
key="hibernate.show_sql">true</prop>
<prop
key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop>
<prop
key="hibernate.max_fetch_depth">1</prop>
<prop
key="hibernate.cache.use_query_cache">false</prop>
<prop
key="hibernate.cache.provider_class">net.sf.hibernate.cache.EhCacheProvider</prop>
<prop
key="hibernate.cache.query_cache_factory">net.sf.hibernate.cache.StandardQueryCacheFactory</prop>
</props>
</property>
which shows that the max_fetch_depth is working,
but I
have no clue wether the proxies are now enabled.
(I am a bit nervous: I have a very important demo
tonight; everything works, but because of this
"cascading query" problem, everything is now
unacceptably slow...)
bernard
This is very strange, since I am using them in all
my proyects and it
works perfectly. Which Andromda version are you
using?
Carlos
Bernard Sirius wrote:
Hi Carlos,
I followed your advice, but now that proxies are
enabled I get a very strange
NoClassDefFoundError,
without a stack trace:
BUILD FAILED
File...... C:\Documents and
Settings\Candide\.maven\cache\maven-test-plugin-1.6.
2\plugin.jelly
Element... junit
Line...... 133
Column.... 41
java.lang.NoClassDefFoundError
Total time: 7 seconds
Finished at: Fri Mar 04 15:26:43 GMT+01:00 2005
Besides, that doesn't explain the fact that
one-2-one
relations become many-to-one...
bernard
--- Carlos Cuenca <[EMAIL PROTECTED]> wrote:
Hi Bernard,
to get rid of all those outer joins when
creating
a
simple query, just
turn on the hibernate proxies. Namespace
property
"hibernateProxy=true"
Carlos
Bernard Sirius wrote:
Hi!
Again, I have this problem with hibernate: a
simple
query generates an incredible amount of SQL. I
was
thinking that specifying outer-join="false"
would
solve this, but it doesn't as you probably
guess.
I can't figure out how to tell hibernate NOT to
eagerly load relations. It seems to be
completely
ignorant of the "lazy=true" attribute.
Now that I've set outer-join="auto", which is
AndroMDA's default, I have hibernate complain
that
"MySQL can only use 31 tables in a join", which
is
documented in their faq
(http://hibernate.bluemars.net/117.html#A29).
So, as a last resort, as is stated there, I'd
like
to
try setting max_fetch_depth to 1 or 2, only I
don't
know how to let AndroMDA specify that.
Of course please let me know if you have other
suggestions
bernard
PS: the hibernate query:
String query = "SELECT person FROM
fractals.psychos.core.ontology.entity.PersonImpl
"
=== message truncated ===
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
|