With the server environment configured and ready to deal with persistent objects, all that we need to do is give it some POJOs and perhaps arm ourselves with some JPA utility classes to make our work easier. For our recipe, we will create a grid that displays a list of students. The grid will retrieve the student records from the database using JPA and will support deleting and adding students. The add and delete operations on the grid will be persisted to the database using an RPC call that will use JPA.
Create a Student
class, as usual it implements BeanModelTag
(or the equivalent BeanModelMarker
approach) and is Serializable
, which are requirements for GXT data components and GWT's RPC respectively. Make sure the Student
class has a default (no argument) constructor, and a toString()
method. equals()
, and hashCode()
are also highly recommended along with the regular getters/setters.
public class Student implements BeanModelTag, Serializable...