-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gavin King
Sent: Wednesday, April 28, 2004 2:25 AM
To: Henri Tremblay
Cc: 'hibernate-devel'
Subject: Re: [Hibernate] Startup time

Gavin King wrote:

>>2- Lazy load the conf. I mean, don't load every file at the beginning, 
>>only when the session using the configuration needs it. So for instance 
>>load a persistent class only when there's a query on it. Again, a 
>>having the two possibilities will be nice (everything at startup or as 
>>needed). However, as Gavin said, it might not be possible... One cannot 
>>guess where is the class of query he is looking for. It might become 
>>possible it we change the approach. For instance having a 
>>addLazyClass(Class persistentClass) method so you know that it you need 
>>the mapping the the class, you know it's in the hbm.xml having the same
name.
>>  
>>

>This would be really hard. Remember that each class needs to know about all
associated classes to figure out fk types, etc.

Maybe introducing some kind of interface for SessionFactoryImpl to get
mapping information would help. Currently user creates
Configuration object which is passed to SessionFactoryImpl which creates
Maps for all kinds of hibernate objects.
It is now not possible to dynamic load this stuff, becouse Hibernate simply
checks in this Map for given object and there is no chance
to load this if necessery.
If SessionFactory would get persisters etc. through some interface, then
implemetntaion could do lazy loading if necessery. 

The problem could be performance impact for queries becouse now this Maps
are final (althougth making this "configuration" interface field final
should have the same effect)

With such configuration "pulling"  interface would also be easy to get lazy
persistent mappigs from different sources (e.g. database or anywhere else).
Having option to store mapping in database would also pay off in performance
as it should be faster than parsing lot of XML files.

Lazy configuration is the best choice to make it fast to start application
with hundreds of persistent class especially for testing and client
applications where during application life time user can use only small
percent of them

----------------
Marek Mosiewicz
http://www.jotel.com.pl



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to