• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

J2EE - Entity & Entity Listeners usage

 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a newbie in J2EE.

When i was going through the Entity listeners, the declaration looks like



Instead i expect the otherway round, it should be like


I feel the second approach is extendable, say for example, if i want to write a new listener for the existing entities, it would be easy to do it in the second approach. All i have to do is that write a new listener class and associate all the entities that the new listener is willing to handle.

Can someone explain why it is done in the other way?


 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably no good reason, just the way things ended up.

The events started as just annotating Entity methods, then the listeners were added, it was easiest just to add them as another annotation on the Entity, instead of having to introduce another type of annotated class.

I like your idea of annotating a EntityListener, perhaps suggest it to the spec group for a future release.
 
reply
    Bookmark Topic Watch Topic
  • New Topic