Database Reference
In-Depth Information
Data Structures
The application requires some standard data structures that will just act as transfer objects for us.
These aren't particularly interesting, but are required to keep things organized. We'll use a Hotel
data structure to hold all of the information about a hotel, shown in Example 4-2 .
Example4-2.Hotel.java
package com.cassandraguide.hotel;
//data transfer object
public class Hotel {
public String id;
public String name;
public String phone;
public String address;
public String city;
public String state;
public String zip;
}
This structure just holds the column information for convenience in the application.
We also have a POI data structure to hold information about points of interest. This is shown in
Example 4-3 .
Example4-3.POI.java
package com.cassandraguide.hotel;
//data transfer object for a Point of Interest
public class POI {
public String name;
public String desc;
public String phone;
}
We also have a Constants class, which keeps commonly used strings in one easy-to-change
place, shown in Example 4-4 .
Example4-4.Constants.java
package com.cassandraguide.hotel;
import org.apache.cassandra.thrift.ConsistencyLevel;
public class Constants {
Search WWH ::




Custom Search