Wednesday, July 31, 2013

JDeveloper 12c - WebService support for EJB entities having foreign key relationship

Oracle Jdeveloper provides an easily way to create SOAP Webservice based on EJB entities, just need to annotate SessionEJBBean with @Webservice or right click on the SessionEJBBean and in context menu click on "Create Web Service".

In earlier version of Jdeveloper you can create Webservice based on EJB entities having foreign key relationship(Departments and Employees tables).  Run the Webservice in Jdeveloper WADL, this will give the Response HTTP headers Status as 200 but no content will be displayed because of the foreign key relationship.


Now Jdeveloper 12c supports creating the Webservice based on EJB entities having foreign key relationship(Departments and Employees tables), to achieve this while creating the "EJB Entities from Tables" we need to select "Generate For Webservice".


Here Departments entity has foreign key relationship with Employees entity but when we run the Webservice in Jdeveloper WADL, this will give the Response HTTP headers Status as 200 and records will be returned only for Departments entity not employee list associated with departmentId.