With JDeveloper you can generate an EJB datacontol on an EJB session bean and this Datacontol can be used in ADF. In this blog entry I will show you what the new features are and how you can do it yourself.
First we start with an entity, this is a normal entity on the country table in the HR schema ( I use the eclipselink persistence implementation, which supported very well in JDeveloper )

Next step is to create a Session Bean where we add some Facade Methods.




If we now go the viewcontroller project we can use this Country EJB datacontrol ( add the EJB model project to the viewcontroller project dependency or add the EJB ADF library to the project) . In the Data Controls window you can see the Named Criteria folder in the countriesFindAll method. Drag the All Queriable Attributes on the JSF page and select the Query Panel option.




Here some eclipselink logging to let you see that is really works.
[EL Fine]: 2009-11-12 14:03:47.375--ServerSession(22965561)--SELECT COUNT(COUNTRY_ID) FROM COUNTRIES
[EL Fine]: 2009-11-12 14:03:47.39 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [5, 0]
[EL Fine]: 2009-11-12 14:03:49.953 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [10, 5]
[EL Fine]: 2009-11-12 14:04:39.281 --SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (SELECT COUNTRY_ID AS COUNTRY_ID1
, COUNTRY_NAME AS COUNTRY_NAME2, REGION_ID AS REGION_ID3 FROM COUNTRIES) a WHERE ROWNUM <= ?) WHERE rnum > ?
bind => [15, 10]
can u please guide on how to create a inputListOfValues using EJB ? i know how to create a inputListOfValues using a VO. Please advise.
ReplyDeleteHi,
ReplyDeleteyou have to do it manually, you can't create a lov on a viewobject attribute.
first display your form or table and replace an inputtext with inputListOfValues , use the same binding for the value.
then add the methodaction + its iterator to the pagedef of that page , add a tree binding on that iterator.
in the jspx page inside in the inputListOfValues add the values based on this tree.
like this
<af:selectOneChoice value="#{bindings.deptIdLocal.inputValue}"
label="Dept">
<af:forEach items="#{bindings.DeptLOV1.rangeSet}"
var="li">
<af:selectItem label="#{li.DepartmentName}"
value="#{li.DepartmentId}"/>
</af:forEach>
</af:selectOneChoice>