-->
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.  [ 3 posts ] 
Author Message
 Post subject: anyway to prevent CGLIB enhancment in applet?
PostPosted: Thu Dec 11, 2003 4:31 pm 
Newbie

Joined: Thu Dec 11, 2003 3:27 pm
Posts: 12
Before using hibernate, I'd typically have a data communication (DC) object for each entity bean. For example, if I had CustomerEntityBean, I'd have a Serializable CustomerDC object to pass to any front-end code.
I don't see the need for DC objects with hibernate. So in my current project, where we have an applet talking to stateless session beans, I just pass around the serializable POJOs that have been mapped to the database via hibernate.
But lately I've been getting "CGLIB Enhancement failed" exceptions on some objects in the applet. These exceptions aren't fatal, but they really slow down processing time, because in some situations I see this exception for each POJO being loaded into a JTable.
And the thing is, I don't think I want CGLIB enhancement in the applet. I love it on the server-side, where my customer.getCreditCard() magically turns into a sql statment, but what good does it do me on the applet?
So I wonder if there's any way to turn enhancement off in the applet jvm, and if that's even a sensible thing to do.
In fact, I thnk I probably somehow had CGLIB enhancement turned off earlier, because this problem only started when our project moved from an ant build to a maven build. At that point we made a whole slew of changes, some to the .war that holds the applet, some to the way we deploy server-side code to jboss (we now drop a hibernate.sar into jboss's deploy directory.)
Anyway, any advice would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 11, 2003 7:41 pm 
Beginner
Beginner

Joined: Fri Aug 29, 2003 3:39 pm
Posts: 33
Location: San Francisco, CA
I'm guessing you just need to remove the "proxy" attributes from your mapping for those particular classes. This will ensure that the objects passed to the applet are not proxies (i.e. they will have the actual data).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 12, 2003 11:36 am 
Newbie

Joined: Thu Dec 11, 2003 3:27 pm
Posts: 12
Thanks for the suggestion. I'd like to get rid of the proxies, but they're integral to our code. They allow us to have true polymorphism.

As described in the reference manual (section 5.4 in the version I'm looking at), this code won't work:

if(cat.isDomesticCat()){
DomesticCat dc = (DomesticCat) cat;
dc.doSomeDomesticCatSpecificBehavior();
}

You'll get an error when you attempt to cast cat to DomesticCat. But if you create ICat and IDomesticCat interfaces, and if you declare ICat as a proxy for Cat and IDomesticCat as a proxy for DomesticCat, then the cast below will work:

if(icat.isDomesticCat()){
IDomesticCat dc = (IDomesticCat) icat;
dc.doSomeDomesticCatSpecificBehavior();
}

So we need to keep our proxies.


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

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.