public abstract class HibernateRepository<T extends DataModel> extends Object implements IRepository<T>
Constructor and Description |
---|
HibernateRepository() |
Modifier and Type | Method and Description |
---|---|
T |
create(T model)
Creates new object in the database
|
protected static org.hibernate.Session |
currentSession()
Obtain the current hibernate
Session . |
void |
delete(T object)
Deletes an
DataModel from the database. |
protected T |
get(Class<T> clazz,
long id)
Retrieve an
DataModel object from the database by Class and database id. |
protected javax.persistence.criteria.CriteriaBuilder |
getBuilder() |
T |
update(T object)
Updates an existing object in the database, if found
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
protected static org.hibernate.Session currentSession()
Session
.Session
protected javax.persistence.criteria.CriteriaBuilder getBuilder()
public void delete(T object)
DataModel
from the database.delete
in interface IRepository<T extends DataModel>
object
- model to deletepublic T update(T object)
update
in interface IRepository<T extends DataModel>
object
- Object to updateprotected T get(Class<T> clazz, long id) throws DAOException
DataModel
object from the database by Class and database id.clazz
- class type for DataModel
id
- unique synthetic identifier for DataModel
DAOException
Copyright © 2017. All rights reserved.