|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.appfuse.dao.jpa.UniversalDaoJpa
public class UniversalDaoJpa
This class serves as the a class that can CRUD any object witout any Spring configuration. The only downside is it does require casting from Object to the object class.
| Field Summary | |
|---|---|
protected javax.persistence.EntityManager |
entityManager
Entity manager, injected by Spring using @PersistenceContext annotation on setEntityManager() |
protected org.apache.commons.logging.Log |
log
Log variable for all child classes. |
| Constructor Summary | |
|---|---|
UniversalDaoJpa()
|
|
| Method Summary | |
|---|---|
java.lang.Object |
get(java.lang.Class clazz,
java.io.Serializable id)
Generic method to get an object based on class and identifier. |
java.util.List |
getAll(java.lang.Class clazz)
Generic method used to get all objects of a particular type. |
void |
remove(java.lang.Class clazz,
java.io.Serializable id)
Generic method to delete an object based on class and id |
java.lang.Object |
save(java.lang.Object o)
Generic method to save an object - handles both update and insert. |
void |
setEntityManager(javax.persistence.EntityManager entityManager)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log log
protected javax.persistence.EntityManager entityManager
| Constructor Detail |
|---|
public UniversalDaoJpa()
| Method Detail |
|---|
public void setEntityManager(javax.persistence.EntityManager entityManager)
public java.lang.Object save(java.lang.Object o)
save in interface UniversalDaoo - the object to save
public java.lang.Object get(java.lang.Class clazz,
java.io.Serializable id)
get in interface UniversalDaoclazz - model class to lookupid - the identifier (primary key) of the class
org.springframework.orm.ObjectRetrievalFailureExceptionpublic java.util.List getAll(java.lang.Class clazz)
getAll in interface UniversalDaoclazz - the type of objects (a.k.a. while table) to get data from
public void remove(java.lang.Class clazz,
java.io.Serializable id)
remove in interface UniversalDaoclazz - model class to lookupid - the identifier (primary key) of the class
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||