This week's book giveaway is in the OCP forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests and have Scott Selikoff and Jeanne Boyarsky on-line! See this thread for details.
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
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.
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding: