Java Reference
In-Depth Information
Our model consists of two POJOs for the Account and Opportunity objects used by the
application. These domain-specific objects are constructed by the servlet and passed to
and from the controller to the views. Your application uses JDO, therefore Listings 4-6
and 4-7 represent the objects along with the required annotations for JDO.
Listing 4-6. The code for
package com.appirio.entity;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account {
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long
@Persistent private String name;
@Persistent private String city;
@Persistent private String state;
@Persistent private String phone;
@Persistent String website;
public Account(String name, String city, String state, String phone,
String website) { = name; = city;
this.state = state; = phone; = website;
* @return the id
public Long getId() {
Search WWH ::

Custom Search