Book Image

Vaadin 7 Cookbook

Book Image

Vaadin 7 Cookbook

Overview of this book

Table of Contents (19 chapters)
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using Grails ORM for Vaadin application


We will create a simple application that will have access to the database. In the database, there will be one entity, User. A visitor of our application will see the list of the users fetched from the database (it is going to be two women's names, Sara and Ester).

How to do it…

Carry out the following steps in order to connect a Vaadin application with the database in a Grails environment:

  1. First, we need to make a new domain class named User. This class will be placed inside the domain folder.

  2. A new dialog window appears and we just type in user. The package name is automatically taken from the name of the project. If we want to specify a different package name, we just type the full name of the class, such as mycomp.User.

    Alternatively, we can create the domain class from the Grails command line:

    grails create-domain-class user
    
  3. The User class has been generated into the domain folder inside the vaadin.grails.gorm package. We will add a new field that...