com.melloware.jukes.db
Class HibernateDao

java.lang.Object
  extended by com.melloware.jukes.db.HibernateDao

public final class HibernateDao
extends java.lang.Object

Static methods for access data using Hibernate.

Copyright (c) 1999-2007 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III

Method Summary
static void attachClean(AbstractJukesObject instance)
          Attaches a clean instance of an object to a session.
static void attachDirty(AbstractJukesObject instance)
          Attaches a dirty instance of an object to a session.
static int count(java.lang.String aHQLQuery)
          Gets a count using a HQL Query.
static long countAll(java.lang.Class aClass)
          Counts ALL of a certain domain class.
static org.hibernate.Criteria createCriteria(java.lang.Class aClass)
          Creates a criteria for the Class.
static void delete(AbstractJukesObject persistentInstance)
          Delete a persistent object from the store.
static void deleteAll(java.util.Collection aCollection)
          Deletes a whole collection from the store.
static java.util.List findAll(java.lang.Class aClass, java.lang.String aSortColumn)
          Find all of an object with a specified sort order.
static java.util.List findByCriteria(org.hibernate.Criteria criteria)
          Finds persistent objects from the store by Criteria provided.
static java.util.List findByExample(AbstractJukesObject instance)
          Finds persistent objects from the store by Example provided.
static AbstractJukesObject findById(java.lang.Class aClass, long id)
          Find by primary key.
static AbstractJukesObject findById(java.lang.Class aClass, java.lang.Long id)
          Find by primary key.
static java.util.List findByQuery(java.lang.String aHQLQuery)
          Find all of an object with a specified HQL Query.
static java.util.List findByQuery(java.lang.String aHQLQuery, int aMaxResults)
          Find all of an object with a specified HQL Query.
static AbstractJukesObject findUniqueByExample(AbstractJukesObject instance)
          Finds a single persistent object from the store by Example provided.
static AbstractJukesObject findUniqueByQuery(java.lang.String aHQLQuery)
          Finds a single object using the aHQLQuery.
static AbstractJukesObject merge(AbstractJukesObject detachedInstance)
          Merges an instance of a persistable object into a session and returns the merged object.
static void persist(AbstractJukesObject transientInstance)
          Persist an object to the store.
static void refresh(AbstractJukesObject transientInstance)
          Refreshes an object from the database.
static void refreshAll(java.util.Collection aCollection)
           
static void saveOrUpdate(AbstractJukesObject transientInstance)
          Persist an object to the store.
static long sum(java.lang.Class aClass, java.lang.String aLongField)
          Gets a sum of a long type column
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

attachClean

public static void attachClean(AbstractJukesObject instance)
Attaches a clean instance of an object to a session.

Parameters:
instance - the instance to attach

attachDirty

public static void attachDirty(AbstractJukesObject instance)
Attaches a dirty instance of an object to a session.

Parameters:
instance - the instance to attach

count

public static int count(java.lang.String aHQLQuery)
Gets a count using a HQL Query.

Parameters:
aHQLQuery - the query to run
Returns:
the count

sum

public static long sum(java.lang.Class aClass,
                       java.lang.String aLongField)
Gets a sum of a long type column

Parameters:
aClass - the class to sum up
aLongField - the field to sum up
Returns:
the sum

countAll

public static long countAll(java.lang.Class aClass)
Counts ALL of a certain domain class.

Parameters:
aClass - the class to count
Returns:
the count

createCriteria

public static org.hibernate.Criteria createCriteria(java.lang.Class aClass)
Creates a criteria for the Class.

Parameters:
aClass - the class to create a criteria for.
Returns:
the Criteria object

delete

public static void delete(AbstractJukesObject persistentInstance)
Delete a persistent object from the store.

Parameters:
persistentInstance - the object to delete

deleteAll

public static void deleteAll(java.util.Collection aCollection)
Deletes a whole collection from the store.

Parameters:
aCollection - the collection to delete

findAll

public static java.util.List findAll(java.lang.Class aClass,
                                     java.lang.String aSortColumn)
Find all of an object with a specified sort order.

Parameters:
aClass - the class to find
aSortColumn - the sort column to use
Returns:
a List of all objects found

findByCriteria

public static java.util.List findByCriteria(org.hibernate.Criteria criteria)
Finds persistent objects from the store by Criteria provided.

Parameters:
criteria - the criteria object to use
Returns:
a List of all objects found

findByExample

public static java.util.List findByExample(AbstractJukesObject instance)
Finds persistent objects from the store by Example provided.

Parameters:
instance - the persistent object to use an as example
Returns:
a List of all objects found

findById

public static AbstractJukesObject findById(java.lang.Class aClass,
                                           long id)
Find by primary key.

Parameters:
aClass - the Class to look for
id - the primary key
Returns:
a persisten object if found by primary key

findById

public static AbstractJukesObject findById(java.lang.Class aClass,
                                           java.lang.Long id)
Find by primary key.

Parameters:
aClass - the Class to look for
id - the primary key
Returns:
a persisten object if found by primary key

findByQuery

public static java.util.List findByQuery(java.lang.String aHQLQuery)
Find all of an object with a specified HQL Query.

Parameters:
aHQLQuery - the query to execute
Returns:
a List of all objects found

findByQuery

public static java.util.List findByQuery(java.lang.String aHQLQuery,
                                         int aMaxResults)
Find all of an object with a specified HQL Query.

Parameters:
aHQLQuery - the query to execute
aMaxResults - the maximum results to return
Returns:
a List of all objects found

findUniqueByQuery

public static AbstractJukesObject findUniqueByQuery(java.lang.String aHQLQuery)
Finds a single object using the aHQLQuery.

Parameters:
aHQLQuery - the query to execute
Returns:
a List of all objects found

findUniqueByExample

public static AbstractJukesObject findUniqueByExample(AbstractJukesObject instance)
Finds a single persistent object from the store by Example provided.

Parameters:
instance - the persistent object to use an as example
Returns:
the object found if one

merge

public static AbstractJukesObject merge(AbstractJukesObject detachedInstance)
Merges an instance of a persistable object into a session and returns the merged object.

Parameters:
detachedInstance - the instance to attach

persist

public static void persist(AbstractJukesObject transientInstance)
Persist an object to the store.

Parameters:
transientInstance - the object to persist

saveOrUpdate

public static void saveOrUpdate(AbstractJukesObject transientInstance)
Persist an object to the store.

Parameters:
transientInstance - the object to persist

refresh

public static void refresh(AbstractJukesObject transientInstance)
Refreshes an object from the database. If you think data may be stale and need updating.

Parameters:
transientInstance - the object to refresh

refreshAll

public static void refreshAll(java.util.Collection aCollection)


Copyright © 1999-2008 Melloware Inc. All Rights Reserved.