From: Max R. A. <max...@jb...> - 2006-05-28 20:50:24
|
> It occurred to me today that you could avoid my objection just by > defining the fetch profile in its own section of the XML, instead of in > the association mappings. eg. > > <profile name="login"> > <association name="User.roles" fetch="join"/> > <association name="User.orders" fetch="select"/> > </profile> And I guess you really want it disjunct from the mapping and not "just" where the assocation is already defined ? <class name="User"> ... <set name="rules" fetch="select"> ... <profile name="login" fetch="join"/> </set> <set name="orders"> ... <profile name="orders" fetch="select"/> </set> </class> Where the name could actually be comma seperated. Note that this construct doesn't prevent still having a <profile name="login"> as a way to declare the association fetching independent on the declaration and of course the shared things. This is always what I wanted, but I guess good things does comes to the one who waits ;) > Then just call session.setProfile("login"), and all criteria queries, > load(), get() and association fetches would obey the profile. > > Frankly, I feel silly for not have considered to do it that way before. > > The <profile> could also be a good place to make some other things > settable, eg, TX isolation mode, flushmode, TX timeout, etc. > > WDYT? Is it a nice construct? +1 (times all the other times I voted for it ;) -- -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate ma...@hi... http://hibernate.org JBoss Inc max...@jb... |