• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts, hibernate 2.1 and jboss 4.0.0

 
zou ch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i'm new in hibernate,
can anybody explain to me what's an interceptor ? why we need it ? and how to chose between interceptor and filters ?
I need also an example with hibernate using caching.

thanx
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An interceptor could be conpared with an event listener in Java. You register an interceptor witrh a SessionFactory and it allows you to interact with objects at certain points in the persistance lifecycle. For example you can implement an interceptor to validate objects in session just before they are saved.

A filter is a Hibernate 3 concept really. The idea with this is Collections of results can be filtered based on certain conditions. I've never used them, but I remember reading a Gavin King article saying they idea behind them was to do things like restrict objects available to users based on user role. So the query remains the same, but the results are filtered depending on authorisation rules.

Caching comes at two levels. The first level cache is implicit, if you get the same object twice in the same session (unless you flush the session) the second get is a cached object. The second level cache needs explicitly implemented using a third party product like JBossCache. You mark an objects "cachability" in its mapping file. How the obejct bahaves in the cache is specific to the cache implementation you use. The second level cache is a more advanced topic, if you want to know more about it I'd recommend you read Hibernate In Action, or the docs which come with the cache implementation.
[ December 14, 2004: Message edited by: Paul Sturrock ]
 
zou ch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi paul,
i don't want to use JBossCache cause i want my application to be as portable as possible (i want to be able to use it in weblogic, websphere, jboss ....). witch cache do u suggest me to use ?
Also how can i test the cache in efficient way?

thanx alot paul
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about EHCache?
 
zou ch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u very much your a champion man. i'm reading hibernate in action.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic