-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Complex class loaders hierarchy
PostPosted: Tue Jun 14, 2005 12:06 am 
Newbie

Joined: Mon Jun 13, 2005 11:46 pm
Posts: 3
Hello,

I've trying to use Hibernate in the environment with complex classloaders hierarchy (in the 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.

How can I achieve this? If this is impossible, 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?).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.