com.gisgraphy.domain.repository

## Interface IDao<T,PK extends Serializable>

- All Known Subinterfaces:
    IAdmDao, IAlternateNameDao, ICityDao, ICountryDao, IGisDao<T>, IGisFeatureDao, IhouseNumberDao, ILanguageDao, IOpenStreetMapDao, IStatsUsageDao, IZipCodeDao
  All Known Implementing Classes:
    AdmBuildingDao, AdmDao, AirportDao, AlternateNameDao, AmbulanceDao, AmuseParkDao, AqueducDao, ATMDao, BankDao, BarDao, BayDao, BeachDao, BenchDao, BridgeDao, BuildingDao, BusStationDao, CampDao, CampingDao, CanyonDao, CasinoDao, CastleDao, CaveDao, CemeteryDao, CinemaDao, CirqueDao, CityDao, CityHallDao, CitySubdivisionDao, CliffDao, CoastDao, ContinentDao, CountryDao, CourtHouseDao, CraftDao, CustomsPostDao, DamDao, DentistDao, DesertDao, DoctorDao, EmergencyPhoneDao, FactoryDao, FallsDao, FarmDao, FerryTerminalDao, FieldDao, FireStationDao, FishingAreaDao, FjordDao, ForestDao, FountainDao, FuelDao, GardenDao, GenericDao, GenericGisDao, GisFeatureDao, GolfDao, GorgeDao, GrassLandDao, GulfDao, HillDao, HospitalDao, HotelDao, HouseDao, HouseNumberDao, IceDao, IslandDao, LakeDao, LanguageDao, LibraryDao, LightHouseDao, MallDao, MarshDao, MetroStationDao, MilitaryDao, MillDao, MineDao, MoleDao, MonumentDao, MoundDao, MountainDao, MuseumDao, NightClubDao, OasisDao, ObservatoryPointDao, OceanDao, OpenStreetMapDao, OperaHouseDao, ParkDao, ParkingDao, PharmacyDao, PicnicDao, PlantationDao, PolicePostDao, PoliticalEntityDao, PondDao, PortDao, PostOfficeDao, PrisonDao, PyramidDao, QuayDao, RailDao, RailRoadStationDao, RanchDao, RavinDao, ReefDao, ReligiousDao, RentalDao, ReserveDao, RestAreaDao, RestaurantDao, RoadDao, SchoolDao, SeaDao, ShopDao, SportDao, SpringDao, StadiumDao, StatsUsageDao, StraitDao, StreamDao, StreetDao, SwimmingPoolDao, TaxiDao, TelephoneDao, TheaterDao, ToiletDao, TourismDao, TourismInfoDao, TowerDao, TreeDao, TunnelDao, UnderSeaDao, VendingMachineDao, VeterinaryDao, VineyardDao, VolcanoDao, WaterBodyDao, ZipCodeDao, ZooDao

      public interface IDao<T,PK extends Serializable>

  Interface of a Generic (java-5 meaning) data access object
  Author:
    David Masclet
  See Also:
    `IGisDao`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `count()`
    `int` | `deleteAll()` Delete all the object from the datastore
    `void` | `deleteAll(List<T> list)` Delete all the specified object from the datastore
    `boolean` | `exists(PK id)` Checks for existence of an object of type T using the id arg.
    `void` | `flushAndClear()` Flush all Memory Objects to the database, and clear the L1 cache, of the current thread-bound Hibernate Session.
    `T` | `get(PK id)` Retrieve the Object whith the specified primary key
    `List<T>` | `getAll()` Generic method used to get all objects of a particular type.
    `List<T>` | `getAllPaginate(int from, int maxResults)` Returns all object of a particular type (i.e getAllPaginate(2,5) will return the [2,3,4,5,6] object
    `Class<T>` | `getPersistenceClass()`
    `void` | `remove(T o)` remove the object from the datastore
    `T` | `save(T o)` Saves the passed object, and returns an attached entity.
    `void` | `setFlushMode(org.hibernate.FlushMode flushMode)` Sets the flush mode (i.e. when objects are flushed to the database) of the current thread-bound session.

- - ### Method Detail

    - #### getPersistenceClass

          Class<T> getPersistenceClass()

      Returns:
        The class, this DAO 'process'

    - #### getAll

          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 (never return null, but an empty list)

    - #### getAllPaginate

          List<T> getAllPaginate(int from,
                               int maxResults)

      Returns all object of a particular type (i.e getAllPaginate(2,5) will return the [2,3,4,5,6] object
      Parameters:
        `from` - The first result to return numbered from 1
        `maxResults` - The maximum list size to return
      Returns:
        List of populated objects, (never return null, but an empty list)
      Throws:
        `org.hibernate.HibernateException` - if thrown by the Hibernate API
        `SQLException` - if thrown by JDBC API

    - #### flushAndClear

          void flushAndClear()

      Flush all Memory Objects to the database, and clear the L1 cache, of the current thread-bound Hibernate Session.
      Throws:
        `org.hibernate.HibernateException` - that Indicates problems flushing the session or talking to the database

    - #### save

          T save(T o)

      Saves the passed object, and returns an attached entity. It is very very very important to use the returned entity, because of the way the underlying mechanism possibly works. For instance, when using Db4o, this is completly useless, but when using JPA and the merge method of the EntityManager, things are going to be buggy (Duplicate Key exceptions) if you don't use the returned object. Please consult EJB3 (or the concrete persistence framework doc) Spec for more information about the way the merge method works.
      Parameters:
        `o` - The object to save
      Returns:
        The saved instance
      Throws:
        `org.springframework.dao.DataAccessException` - in case of errors

    - #### setFlushMode

          void setFlushMode(org.hibernate.FlushMode flushMode)

      Sets the flush mode (i.e. when objects are flushed to the database) of the current thread-bound session. By default, it is equivalent (in the case of JPA persistence) to `FlushModeType.AUTO`, which lets the persistence framework handle that issue. However, for performance reasons, it might be necessary to set it to `FlushModeType.COMMIT`. Warning : this sets the default flush mode of the session (either hibernate `Session`, JPA `EntityManager`, or similar) that is currently bound to the current thread. This means that it has absolutely no effect if no transaction is currently opened.
      Parameters:
        `flushMode` - The flush mode To set for this dao
      Throws:
        `org.hibernate.HibernateException` - if thrown by the Hibernate API
        `SQLException` - if thrown by JDBC API

    - #### remove

          void remove(T o)

      remove the object from the datastore
      Parameters:
        `o` - The object to remove
      Throws:
        `org.springframework.dao.DataAccessException` - In case of errors

    - #### 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
      Throws:
        `org.springframework.dao.DataAccessException` - in case of errors

    - #### get

          T get(PK id)

      Retrieve the Object whith the specified primary key
      Parameters:
        `id` - the primarey key
      Returns:
        The object
      Throws:
        `org.springframework.dao.DataAccessException` - in case of errors

    - #### count

          long count()

      Returns:
        the number of element in the Datastore
      Throws:
        `org.hibernate.HibernateException` - if thrown by the Hibernate API
        `SQLException` - if thrown by JDBC API

    - #### deleteAll

          void deleteAll(List<T> list)

      Delete all the specified object from the datastore
      Parameters:
        `list` - the list of element to delete
      Throws:
        `org.springframework.dao.DataAccessException` - in case of errors

    - #### deleteAll

          int deleteAll()

      Delete all the object from the datastore
      Returns:
        the number of deleted objects
      Throws:
        `org.springframework.dao.DataAccessException` - in case of errors

Copyright © 2015. All rights reserved.