Monday 4 May 2009

2-How to Develop Bean-Managed-Persistence Entity Beans

The missing link in Mr. tinptb’s Web page is the implementation of the data source. Also, I was not sure whether the source files he provided would work in WebLogic 10.3 or Jdev11g either. Unfortunately, the client source he has provided is some what scrambled for some mysterious reason(but actually works OK). All in all, I guess Mr.TINPTB’s purpose was to give an example of Entity Beans rather than telling everything with full details which is almost impossible sometimes.

I created/copied the StudentXXX files as given in EJB in 21 Days. I had to change the library name(bmpex).
I also put the ejb-jar.xml, weblogic-ejb-jar.xml files into src/META-INF directory. So, the directory structure is:
BMPex
src
Bmpex................................. META-INF .......Client.java... jndi.properties
Student.java ........................ejb-jar.xml
StudentDAO.java .................weblogic-ejb-jar.xml
StudentDAOPB.java
StudentDetails.java
StudentEJB.java
StudentHome.java


At the same level with src lies:
Lib ..............................Build ...............Deploy ...............build.xml
wlfullclient5.jar

My approach to the problem was two thronged. I used an ANT build.xml to create the EJB and deployed it with WLST, afterwards tested it with ANT RUN command. On the other hand, I used Jdeveloper, to make my changes and have an overall view of my efforts with the easy to use IDE. I also used Jdev to run the client and analyze the error messages which is much better there.