• Post Reply Bookmark Topic Watch Topic
  • New Topic

About Ejbs and MDbs  RSS feed

 
Kendru Estrada
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

My question about EJB 2.0
Is it possible that an EJB (Session Stateles) is also a MDB (Message Driven
Bean)?
Do this is a good idea?

Someone on my team going to do this, I think it is not a good idea, but ...
I do not know why



pd: sorry for my bad english
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kendru,
Welcome to JavaRanch!

I recommend asking your coworker for more detail about what he/she intends to do. It is not possible for the same class to be a session bean and a message driven bean. They extend different classes which makes it impossible to be both.

It is possible and fairly common to have a message driven bean call a session bean. Maybe that is what was intended?
 
Kendru Estrada
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Kendru,
Welcome to JavaRanch!

I recommend asking your coworker for more detail about what he/she intends to do. It is not possible for the same class to be a session bean and a message driven bean. They extend different classes which makes it impossible to be both.

It is possible and fairly common to have a message driven bean call a session bean. Maybe that is what was intended?


mm i don't see the incompatibility, SessionBean and MessageDrivenBean Both are interfaces,
in java is possible to implement 2 interfaces
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually that's a good point. I forgot about that. I take back what I said.
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't see the incompatibility, SessionBean and MessageDrivenBean Both are interfaces,
in java is possible to implement 2 interfaces


That may be so - but it is besides the point. What do you gain by doing this?
To achieve this, you should register the class twice - as an mdb and an ejb as each needs to have it's own DD.
Each needs its own jndi name and app specific resources.

Next how is it planned to implement methods common to both ejbs? For example ejbRemove() - how are you going to code this considering that the object may be an mdb or en ejb at runtime?

You should consider obtaining a maintenance contract from your co-worker

ram.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!