Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • 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

regards
Sankar
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic