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
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to