Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

HFEJB - Page 582 / same method name in Home and Component interface

Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to Page 582 of HFEJB, <method-intf> element is used to resolve name conflicts if the same method name is defined in Home and Component interface.
While i understand the purpose of <method-intf> tag, i cannot visualize a scenario where this would be required. Can some body provide an example ?

I am also of the opinion that this feature might be useful only in the case of entity beans. Because only in entity beans Bean providers have the freedom to define additional business methods in home interface.

Please correct me if i am wrong.

Note: While writing this post, it struck to me that this feature can be useful to resolve conflicts between the following:
1) Home and LocalHome
2) Remote and Local componet interfaces

Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sankar,
The <method-intf> tag belongs to the <method> element. The <method> sub-element can be used in both the <container-transaction> as well as the <method-permission> elements. <container-transaction> is used to specify the transaction attributes. Session beans have only create methods in the home interface which are non-transactional. So you would not specify transaction attributes for them. So you won't be using the <method-intf> tag for session beans in <container-transaction>. But entity bean home business methods must be given a transaction attribute and if you have for example, a home business method and component interface business method with the same name and you want to specify different Tx attributes for them, you would be using the <method-intf> tag. So you are right in the sense that you would not use the <method-intf> tag with <container-transaction> for session beans as you won't specify Tx attributes for home create methods.

But remember that you can also use the <method> element in <method-permission>. What if you have a create<something> method in both the home interface and component interface of a session bean? It's not illegal though a bit strange to have a create<something> method in the component interface. What if you want to specify different method permissions for these methods? You have to distinguish between them. You might also have a scenario where you want to provide different role-based access for a method with the same name in the local and remote interfaces (home or component). These scenarios would require the use of <method-intf> for session beans as well.
    Bookmark Topic Watch Topic
  • New Topic