Pages

Tuesday, June 7, 2011

EJB and ADF Java or EJB DataControl features in JDeveloper 11gR2

Today Oracle released JDeveloper 11gR2 and it's time to do a testdrive on the new EJB, JPA and ADF JAVA or EJB Datacontol R2 features. Last Open World I had a great meeting about these features with Frank Nimphius and one of the developer who made this happen. So I am very curious about this new release.

We start with the Model project and do Create Entities from Tables to add some entities to the model project.

In the wizard you can disable the discovering of Foreign Keys and generate a toString method on the entity
An overview of the entity attributes with it's types.
You can define and change the entity mappings, no need to do it in the persistence.xml wizard.
The persistence.xml entity editor has some extra configuration windows like the locking, Caching, Installation, Converters and the Advanced window

The generation of a SDO Service Interface on the Bean used to go very wrong ( start it by generating service interface on the session bean). Now I only have to fix the response elements of the SessionBean XSD with the right types ( but this is so easy because the property editor of jdeveloper can see the imported types).


Next step is to add an EJB Session Bean and generate an ADF DataControl on the remote interface.
Here you can see that there are no ADF xml Entity files.
Unless you want to change the default values. Select one of the methods and press the edit button
The editor is much better and the attribute windows contains a lot of new options like Validations Rules, Add a Transiet Attribute.
 You can add Attribute Checks or Rules just like ADF BC
 Add your own View Criteria ( like in a viewobject of ADF BC )  which you can use in a Query Panel

And the last feature for now, is the JNDI url for the remote EJB in the web.xml of your Web application. before 11gR2 you should use a foreign JNDI provider or change with ANT the provider-url  in the ejb-definition. Now when you drag the EJB DataControl into your web application then JDeveloper adds a ejb-ref entry to the web.xml but also add a new env-entry with the EJB DataControl name so you can provide the t3 url in the web.xml. The web.xml can be changed in a weblogic deployment plan.

  <env-entry>
    <env-entry-name>ScottSessionEJB-provider-url</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>t3://127.0.0.1:7101</env-entry-value>
  </env-entry>
  <ejb-ref>
    <ejb-ref-name>ejb/ScottSessionEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>nl.whitehorses.ejbdc.model.services.ScottSessionEJB</remote>
    <ejb-link>ScottSessionEJB</ejb-link>
  </ejb-ref>

That's all for Part 1, next time we can gonna use the ADF EJB DataControl in a JSF Page.

7 comments:

  1. Hi,

    it is the full version of JDeveloper 11g.

    thanks

    ReplyDelete
  2. Hi Edwin..what if i am not creating any data control out of session bean?i have another pojo class based on session bean where i need to create the Datacontrol. In that case i am not gonna get all the facility which session bean datacontrol give,and in that case how to make a custom search page,i will appreciate your feedback Edwin,

    Thanks,
    Satya

    ReplyDelete
  3. Hi Edwin i am using J developer 11.1.1.5 and i have tried the same example but the i didn't get all the Entity class Option(Eg:Named Query)when you create a entity from table.pl suggest your view on that.

    Thanks,
    Satya

    ReplyDelete
    Replies
    1. Hi,

      its part of Jdeveloper 11.1.2. but for only JPA you can use 11gR2 but not when you also use it with ADF.

      Thanks

      Delete
  4. Hi Edwin , We are on 11gr1 and want to externalize the provider-url for EJB in a EJB data control. You have mentioned that I can use the Foreign JNDI provider with EJB data control. Any pointer on how do I do that as the EJB data control .

    ReplyDelete
    Replies
    1. Hi,

      With 11gR1 and Remote EJB you need to update the datacontrol.dcx and update the localhost t3 url. I do this with hudson. open jar update the connection and zip it again.

      In R2 you can update the url in the web.xml with a deployment plan.

      thanks

      Delete