Java Reference
In-Depth Information
Model
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 Account.java
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 {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long
id;
@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) {
this.name = name;
this.city = city;
this.state = state;
this.phone = phone;
this.website = website;
}
/**
* @return the id
*/
public Long getId() {
 
Search WWH ::




Custom Search