GenericDao (gisgraphy 2.0-final API)
Date: 2010-09-01

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gisgraphy.dao
Interface GenericDao<T,PK extends java.io.Serializable>

Type Parameters:
  `T` - a type variable
  `PK` - the primary key for that type

All Known Subinterfaces:
  RoleDao, UserDao

All Known Implementing Classes:
  GenericDaoHibernate, RoleDaoHibernate, UserDaoHibernate

    public interface GenericDao<T,PK extends java.io.Serializable>

Generic DAO (Data Access Object) with common methods to CRUD POJOs. Extend this interface if you want typesafe (no casting necessary) DAO's for your domain objects.

Author:
  Bryan Noll, David Masclet

Method Summary
`boolean` | `exists(PK id)` Checks for existence of an object of type T using the id arg.
`T` | `get(PK id)` Generic method to get an object based on class and identifier.
`java.util.List<T>` | `getAll()` Generic method used to get all objects of a particular type.
`void` | `remove(PK id)` Generic method to delete an object based on class and id
`T` | `save(T object)` Generic method to save an object - handles both update and insert.

Method Detail

### getAll

    java.util.List<T> getAll()

  Generic method used to get all objects of a particular type. This is the same as lookup up all rows in a table.

  Returns:
    List of populated objects

### get

    T get(PK id)

  Generic method to get an object based on class and identifier. An ObjectRetrievalFailureException Runtime Exception is thrown if nothing is found.

  Parameters:
    `id` - the identifier (primary key) of the object to get
  Returns:
    a populated object
  See Also:
    `ObjectRetrievalFailureException`

### exists

    boolean exists(PK id)

  Checks for existence of an object of type T using the id arg.

  Parameters:
    `id` - the id of the entity
  Returns:
    - true if it exists, false if it doesn't

### save

    T save(T object)

  Generic method to save an object - handles both update and insert.

  Parameters:
    `object` - the object to save
  Returns:
    the persisted object

### remove

    void remove(PK id)

  Generic method to delete an object based on class and id

  Parameters:
    `id` - the identifier (primary key) of the object to remove

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.