Title: [Hibernate] Complex class loaders hierarchy
 
cant see your attachement (at netcafe ,), but im quite sure this is not the right solution to this *eclipse* problem ,)
 
And I cant recall having this issue when installing own classloader.
 
you should go to eclipse and look for the bug talking about buddy classloading which can handle
this via eclipse classloader madness.
 
max

From: [EMAIL PROTECTED] on behalf of Ivan S. Dubrov
Sent: Tue 14-06-2005 17:00
To: hibernate-devel@lists.sourceforge.net
Subject: [Hibernate] Complex class loaders hierarchy

Hello,

I've trying to use Hibernate in the environment with complex classloaders hierarchy (Eclipse plugin). During my experiments I've found the following problem. In order to proxy generation (via cglib) to work it is required that HibernateProxy is visible from the classloader that loads mine entities (since CGLib Enhancer by default uses superclass classloader).

But in mine environment this is not true, since I do not want to make plugin with entities to depend on the plugin with Hibernate jar (so hibernate classes are not visible from the classloader that loads entities).

To make Hibernate see my entities I set my own thread context classloader that "sees" both Hibernate jars and enities. So what I want is to make Enhancer use this classloader when generating proxy too.

I propose the following modification to the CGLIBLazyInitializer:

First, try generate proxy with default classloaders (superclass classloader). If it fails, try to generate proxy with Enhancer classloader set to the current thread context classloader. I think, this will be consistent with current implementation, since it already uses thread context classloader to load entities (so why not to use this classloader for proxy generation too?).

I've attached a simple patch for this issue that shows the idea.

Reply via email to