|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@ApplicationScoped public interface AdaptrexPersistence
AdaptrexPersistence provides an interface to an variety of implementations that
handle persistence between Adaptrex and an ORM. Currently only a standard JPA2
(via EclipseLink) implentation is included but he eventual goal is to allow nearly
any ORM to be supported (Hibernate, Cayanne, TopLink, OpenJpa, etc, etc).
Some of the code in adaptrex-core that uses this API is currently JPA specific.
com.adaptrex.core.ext.data.ModelInstance scans its target entity several times and
reads JPA annotations to determine things like join types and the type of objects
being retrieved. The AdaptrexPersistence interface should be made much more robust
to handle this functionality and current functionality should move to the JPA specific
implementation.
Because this API is not yet 100% stable, it should only be used inside other adaptrex-core code
| Method Summary | |
|---|---|
Object |
deleteEntity(String className,
Integer id)
This should delete an entity from the default persistence unit based on the supplied className and id |
Object |
deleteEntity(String className,
Integer id,
String persistenceUnitName)
This should delete an entity from the specified persistence unit based on the supplied className and id |
Object |
getEntity(Class<?> clazz,
Integer id)
This should return a single entity object from the default persistence unit based on the supplied class and id |
Object |
getEntity(Class<?> clazz,
Integer id,
String persistenceUnitName)
This should return a single entity object from the specified persistence unit based on the supplied class and id |
Object |
getEntity(String className,
Integer id)
This should return a single entity object from the default persistence unit based on the supplied className and id |
Object |
getEntity(String className,
Integer id,
String persistenceUnitName)
This should return a single entity from the specified persistence unit based on the supplied className and id |
Class<?> |
getEntityClass(String className)
This should return the class for a specific className in the default persistence unit (JPA Persistence Unit, Hibernate session, etc, etc). |
Class<?> |
getEntityClass(String className,
String persistenceUnitName)
This should return the class for a specific className in the specified persistence unit (JPA Persistence Unit, Hibernate session, etc, etc). |
List<Object> |
getEntityList(Store store)
This should return a list of objects that comprise the data that is to be included in an ext.data.Store. |
List<Object> |
getEntityList(Store store,
String persistenceUnitName)
This should return a list of objects from the default persistence unit that comprise the data that is to be included in an ext.data.Store. |
Object |
getEntityManager()
This should return the default entity manager for whichever implementation is being used. |
Object |
getEntityManager(String persistenceUnitName)
This should return the specified entity manager for whichever implementation is being used. |
Object |
getFieldValue(Object entity,
String fieldName)
|
Object |
getFieldValue(Object entity,
String fieldName,
String persistenceUnitName)
|
boolean |
isIdField(Class<?> clazz,
String fieldName)
|
boolean |
isIdField(Class<?> clazz,
String fieldName,
String persistenceUnitName)
|
boolean |
isManyToOne(Class<?> clazz,
String fieldName)
|
boolean |
isManyToOne(Class<?> clazz,
String fieldName,
String persistenceUnitName)
|
boolean |
isOneToMany(Class<?> clazz,
String fieldName)
|
boolean |
isOneToMany(Class<?> clazz,
String fieldName,
String persistenceUnitName)
|
Object |
saveEntity(Object entity)
This should save (create or update) the supplied entity using the default persistence unit and return an updated instance of the entity |
Object |
saveEntity(Object entity,
String persistenceUnitName)
This should save (create or update) the supplied entity using the specified persistence unit and return an updated instance of the entity |
| Method Detail |
|---|
Class<?> getEntityClass(String className)
className -
Class<?> getEntityClass(String className,
String persistenceUnitName)
className -
List<Object> getEntityList(Store store,
String persistenceUnitName)
store -
List<Object> getEntityList(Store store)
store -
Object getEntity(String className,
Integer id)
className - id -
Object getEntity(String className,
Integer id,
String persistenceUnitName)
className - id -
Object getEntity(Class<?> clazz,
Integer id)
class - id -
Object getEntity(Class<?> clazz,
Integer id,
String persistenceUnitName)
class - id -
Object saveEntity(Object entity)
entity -
Object saveEntity(Object entity,
String persistenceUnitName)
entity -
Object deleteEntity(String className,
Integer id)
className - id -
Object deleteEntity(String className,
Integer id,
String persistenceUnitName)
className - id -
Object getEntityManager()
Object getEntityManager(String persistenceUnitName)
boolean isIdField(Class<?> clazz,
String fieldName)
boolean isIdField(Class<?> clazz,
String fieldName,
String persistenceUnitName)
boolean isOneToMany(Class<?> clazz,
String fieldName)
boolean isOneToMany(Class<?> clazz,
String fieldName,
String persistenceUnitName)
boolean isManyToOne(Class<?> clazz,
String fieldName)
boolean isManyToOne(Class<?> clazz,
String fieldName,
String persistenceUnitName)
Object getFieldValue(Object entity,
String fieldName)
Object getFieldValue(Object entity,
String fieldName,
String persistenceUnitName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||