-->
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.  [ 4 posts ] 
Author Message
 Post subject: non-hibernate protected method throws exception?
PostPosted: Wed Mar 09, 2005 3:59 pm 
Newbie

Joined: Wed Mar 09, 2005 2:46 pm
Posts: 8
Hibernate version: 3.0rc1

I have some simple objects that I was originally planning to write my own persistence layer for, but decided to try out hibernate instead.

In a class I have a simple method like this:

protected void setFactory( CampaignFactory factory ) {
this.factory = factory;
}


factory is a transient property and I've haven't mentioned it in the mapping file.

When trying to use this method to set my transient property I get:

java.lang.IllegalArgumentException: Protected method: setFactory(Lcom/taglab/campaigner2/CampaignFactory;)V
at net.sf.cglib.proxy.MethodProxy$1.invoke(MethodProxy.java:55)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
at com.taglab.campaigner2.Campaign$$EnhancerByCGLIB$$20c97667.setFactory(<generated>)
at com.taglab.campaigner2.CampaignFactory.getCampaign(CampaignFactory.java:241)


Which looks like cglib doesn't like the visibility of my method. I tried changing it to public, and then I don't get the error.

However I'm reluctant to leave it as public since it is internal and not part of my public API.

Is it supposed to be this way, or am I barking up the wrong tree?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 10, 2005 6:45 am 
Newbie

Joined: Wed Mar 09, 2005 2:46 pm
Posts: 8
I've been trawling documentation for hours now... I can't find anyhing that shed any light on this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 8:16 am 
Newbie

Joined: Wed Mar 09, 2005 2:46 pm
Posts: 8
This is now starting to seriously throw my API design off.

It seems I can't have any non-public business methods on my persisted objects. Is it really supposed to be that way?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 8:45 am 
Newbie

Joined: Wed Dec 29, 2004 3:45 am
Posts: 7
Location: Leuven, Belgium
I have a very similar problem where a protected method is used to enforce a business rule recursively, in a hierarchy of objects.

Apparently it is fixed in Hibernate 3.0: http://opensource.atlassian.com/project ... se/HHH-222

I still need to try that though....

Erwin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.