-->
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.  [ 6 posts ] 
Author Message
 Post subject: wrong/confusing PersistenceInterceptor & Event model doc
PostPosted: Fri Mar 25, 2005 10:46 am 
Newbie

Joined: Fri Mar 25, 2005 5:01 am
Posts: 6
Hibernate version:3.0

I want to set a transient property after a Entity is loaded by Hibernate.

To do this I tried to use PostLoadEventListener to set my property.

When I tried to register the EventListener as describt in the HTML Documentation:

Configuration cfg = new Configuration();
cfg.getSessionEventListenerConfig().setPostLoadEventListener( new MyPostLoadEventListener() );

I found that there is no "getSessionEventListenerConfig()" method in the Configuration object (wrong documentation) !???

There is a "void setListener(String type, Object listener)" method in Configuration but the parameters are not documented.

So cfg.setListener("sample.MyPostLoadEventListener",myPostLoadEventListener);
does not work :-(

The other way I tried was the Interceptor - Example from the Doku but this failed because I was not able to implement all of the Interceptor-Interface methods and I dont found a base class to extend from.


PLEASE...

can somebody tell me wherea and how I can hock a simple PostLoadEventListener in Hibernate !


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the sessioneventlisternerconfig was removed shortly, but will come back in the final release (it is in cvs now)

if you are using the RC1 then setListener is the current only way to do it programmatically. otherwise use the hibernate.cfg.xml

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:24 am 
Newbie

Joined: Fri Mar 25, 2005 5:01 am
Posts: 6
max wrote:
the sessioneventlisternerconfig was removed shortly, but will come back in the final release (it is in cvs now)

if you are using the RC1 then setListener is the current only way to do it programmatically. otherwise use the hibernate.cfg.xml



So could you or somebody tel me how to use

config.setListener(String name,Object listener) ??

name = is .... ? ( it is not "org.hibernate.event.PostLoadEventListener" or "PostLoadEventListener" !)

listener = should be a PostLoadEventListener instance , right ?


I looked in the code and found no hint only a "// todo : ugh!" comment ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
go see how the method is called (Ctrl+shift+G in eclipse) the best doc is there.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Solution found !
PostPosted: Fri Mar 25, 2005 11:30 am 
Newbie

Joined: Fri Mar 25, 2005 5:01 am
Posts: 6
ollmann wrote:
max wrote:
the sessioneventlisternerconfig was removed shortly, but will come back in the final release (it is in cvs now)

if you are using the RC1 then setListener is the current only way to do it programmatically. otherwise use the hibernate.cfg.xml



So could you or somebody tel me how to use

config.setListener(String name,Object listener) ??

name = is .... ? ( it is not "org.hibernate.event.PostLoadEventListener" or "PostLoadEventListener" !)

listener = should be a PostLoadEventListener instance , right ?


I looked in the code and found no hint only a "// todo : ugh!" comment ;-)



A I found it my self :-)) !!!!!!!!!!!!!!!!111

name is "load"

There sould be a class with constants for the name's and a link in the API docu.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
as i said - in final (Current cvs) this is changed to a concrete class.

_________________
Max
Don't forget to rate


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