• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to define 2 versions of the same session bean in one ejb-jar.xml file?  RSS feed

 
Sally Yu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wanna ask if it is possible to define 2 versions of the same session bean in one ejb-jar.xml file? If not, is it possible to define 2 session beans in one ejb-jar.xml file?
I'm pretty new to EJBs and I have to make an application be able to work with an old and a new version of an EJB. Currently the old and new version are merged together and the application calls functions depending on the version number. The only thing lacking now is how to distinguish these versions in the ejb-jar.xml file. Is it possible to define <ejb-class> depending on versions?
Any help would really be appreciated. Thanks!
 
Scott Selikoff
author
Bartender
Posts: 4081
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sally Yu:
is it possible to define 2 session beans in one ejb-jar.xml file?

Yes
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36446
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott,
I agree you can define two session beans. But are you sure you can define two versions of a class?

I think there is a more basic problem - you can't load two versions of the same Java class in the first place as there is no way to differentiate them. Which means the ejb-jar.xml file doesn't even have the second one to point to.
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may deploy it as two different EJB modules [one for new and the other for old version].

Also we may need to change the settings with respective to classloader to mention not to use a unified class loader for the EJB modules. [specifically in JBoss it gives LinkageError]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!