The Simple Persist Module
This module defines two very simple Data Access Objects (DAOs).
A DAO is an object that provides an interface for persistence
operations. In an application that makes use of an Object-Relational
Mapping (ORM) framework such as Hibernate, DAOs are usually defined
around objects. In this project, we are defining two DAO objects:
WeatherDAO
and
LocationDAO
. The WeatherDAO
class allows us to save a Weather
object to a
database and retrieve a Weather
object by id
, and to retrieve
Weather
objects that match a specific
Location
. The LocationDAO
has a
method that allows us to retrieve a Location
object by zip code. First,
letâs take a look at the simple-persist
POM in Example 7-8.
Example 7-8. simple-persist POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.sonatype.mavenbook.ch07</groupId> <artifactId>simple-parent</artifactId> <version>1.0</version> </parent> <artifactId>simple-persist</artifactId> <packaging>jar</packaging> <name>Simple Persistence API</name> <dependencies> <dependency> <groupId>org.sonatype.mavenbook.ch07</groupId> <artifactId>simple-model</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.5.ga</version> <exclusions> <exclusion> <groupId>javax.transaction</groupId> ...
Get Maven: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.