O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing a CMP Entity Bean

Just as for BMP Entity beans, implementing a CMP Entity bean involves providing an implementation for the methods of the javax.ejb.EntityBean, corresponding methods for each method in the home interface, and a method for each method in the remote interface.

Implementing javax.ejb.EntityBean

Under BMP, the setEntityContext() method was used to look up various bean home interfaces from JNDI, and the JDBC DataSource called java:comp/env/jdbc/Agency was also obtained. Because most of these relationships are now managed by the container, only a couple of home interfaces now need to be obtained, and there is no requirement to look up the DataSource. Listing 7.4 shows this.

Listing 7.4. The JobBean's setEntityContext() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required