Max:
Quote:
it would be insanely ugly to carry around a "userclassloader" to do this...and that is actually why there is such a thing as a context classloader.
Don't know about the ugly part, but it's certainly not insane. There are a variety of problems that could use dynamically resolved/dynamically generated classes to solve. Remote code fetching, on-the-fly classfile generation--these things aren't going to fit nicely into a static context. Examples are everywhere--look at just about any J2EE server or, for that matter, at the Hibernate Console, as you point out.
The classloader mechanism is as extensible as it is for a reason--Sun never thought they'd have the be-all/end-all solution. The context loader works just great about 99% of the time. But that 1% really needs the ability to include it's own loader in the delegation chain.
And the beauty of the extensible classloader is that Hibernate doesn't need to care about finding the classes. As long as the config is supplied a valid classmapping and the classload chain-supplied definitions pass the bytecode verifiers, it doesn't have to give a hoot.