1 / 6

Container Managed Persistence

Container Managed Persistence. General Guidelines. Home and Remote interfaces are implemented the same as for bean managed persistence Entity Bean class contains no database access code Application Deployment Tool generates database access statements

Download Presentation

Container Managed Persistence

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Container Managed Persistence

  2. General Guidelines • Home and Remote interfaces are implemented the same as for bean managed persistence • Entity Bean class contains no database access code • Application Deployment Tool generates database access statements • Specify container managed fields when you run the ADT

  3. Rules for Container Managed Fields • Must be one of the following types • Java primitive • Java serializable class • Reference of a home interface • Reference of a remote interface • Must be ‘public’ and not ‘transient’ • One field selected as the primary key (using the ADT)

  4. Implementing Interfaces • Still have to follow the rules for implementing methods required by the interfaces. • Some methods will be empty • EJBLoad() & EJBStore() • Container implements the code • Only need to add stuff to process data if required by the application. • EJBCreate() • Make your field assignments • Container makes the datbase call once the bean is created

  5. Implementing Interfaces (cont) • findByPrimaryKey() • Completely implemented in the container • findByDescription() and findInRange() • Mostly implemented • User adds WHERE clause during deployment (using the ADT).

  6. Here’s a link to Java’s example of how to do it using the J2EE RI…. http://developer.java.sun.com/developer/onlineTraining/… EJBIntro/exercises/EntityBean/index.html

More Related