7. Implementing DAO using JPA

PROBLEM

While the DAO pattern doesn't dictate how the DAO actually handles persistence, object-relational mapping (ORM) is most often used.

SOLUTION

By default Skyway utilizes JPA. Skyway Builder CE automates the use of Hibernate as the JPA provider. For Skyway Builder Standard Edition the JPA provider is configurable.

HOW IT WORKS

The Domain Object Persistence Mapping panel (in the Domain Object Editor) lets you influence how the a domain object is persisted to a database. When a new domain object is created, Skyway Builder will automatically create default persistence mapping values based on the definition of the domain object. For example: if the domain object is named Customer, then the table name will be defaulted to customer. However if you want to use a different table name, you can override the auto-generated persistence configuration.

If you're familiar with JPA, then the configuration settings should look pretty familiar. These settings are directly related to JPA annotations. As you make changes to the Persistence Mapping panel, the annotations in the code associated with the domain objects will be automatically updated.