{"id":152,"date":"2009-12-03T10:30:11","date_gmt":"2009-12-03T10:30:11","guid":{"rendered":"http:\/\/salientsoft.co.uk\/?p=152"},"modified":"2009-12-03T12:43:26","modified_gmt":"2009-12-03T12:43:26","slug":"implementing-dual-interfaces-on-an-ejb","status":"publish","type":"post","link":"https:\/\/salientsoft.co.uk\/?p=152","title":{"rendered":"Implementing Dual Interfaces on an EJB"},"content":{"rendered":"<p>Note that when implementing dual (both Local and Remote)\u00a0interfaces on an EJB, you can extend a single underlying superinterface. In this case, <strong>SimpleBeanLocal<\/strong> and <strong>SimpleBeanRemote<\/strong> both extend <strong>SimpleBean<\/strong>. However, when you do this, the implementation code must explicitly implemement both subinterfaces <strong>SimpleBeanLocal<\/strong> and <strong>SimpleBeanRemote<\/strong> as in this example. Implementing the superinterface <strong>SimpleBean<\/strong> on its own will not work.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">(Super)Interface SimpleBean<\/span><\/strong><\/p>\n<pre>public interface SimpleBean {\r\n   public void createUsers();\u00a0\r\n   public List fetchUsers();\r\n}<\/pre>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong><span style=\"text-decoration: underline;\">(Sub)Interface SimpleBeanLocal<\/span><\/strong><\/p>\n<pre>@Local()\r\npublic interface SimpleBeanLocal extends SimpleBean {}<\/pre>\n<p>\u00a0<\/p>\n<p><strong><span style=\"text-decoration: underline;\">(Sub)Interface SimpleBeanRemote<\/span><\/strong><\/p>\n<pre>@Remote()\r\npublic interface SimpleBeanRemote extends SimpleBean {}<\/pre>\n<p>\u00a0<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Implementation Class SimpleBeanImpl<\/span><\/strong><\/p>\n<pre>@Stateless(mappedName=\"ejb\/JPAGlassFishIceEJB\/SimpleBean\")\r\npublic class SimpleBeanImpl implements SimpleBeanLocal, SimpleBeanRemote {<\/pre>\n<pre>...class Code here...<\/pre>\n<pre>}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Note that when implementing dual (both Local and Remote)\u00a0interfaces on an EJB, you can extend a single underlying superinterface. In this case, SimpleBeanLocal and SimpleBeanRemote both extend SimpleBean. However, when you do this, the implementation code must explicitly implemement both subinterfaces SimpleBeanLocal and SimpleBeanRemote as in this example. Implementing the superinterface SimpleBean on its own [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[18,16],"_links":{"self":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/152"}],"collection":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=152"}],"version-history":[{"count":7,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/salientsoft.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}