|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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 | |
|---|---|
void |
closeNativeSession(Object session)
|
Object |
deleteEntity(AdaptrexSession session,
String className,
Integer id)
This should delete an entity from the default persistence unit based on the supplied className and id |
Object |
getEntity(AdaptrexSession session,
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(AdaptrexSession session,
String className,
Integer id)
This should return a single entity object from the default 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). |
List<Object> |
getEntityList(AdaptrexSession session,
Store store)
This should return a list of objects that comprise the data that is to be included in an ext.data.Store. |
String |
getFieldType(Class<?> clazz,
String fieldName)
|
Object |
getFieldValue(Object entity,
String fieldName)
|
Object |
getNativeSession()
This should return the default session entity manager for whichever implementation is being used. |
boolean |
isIdField(Class<?> clazz,
String fieldName)
|
boolean |
isManyToOne(Class<?> clazz,
String fieldName)
|
boolean |
isOneToMany(Class<?> clazz,
String fieldName)
|
Object |
saveEntity(AdaptrexSession session,
Object entity)
This should save (create or update) the supplied entity using the default persistence unit and return an updated instance of the entity |
void |
shutdown()
|
| Method Detail |
|---|
Class<?> getEntityClass(String className)
className -
List<Object> getEntityList(AdaptrexSession session,
Store store)
store -
Object getEntity(AdaptrexSession session,
String className,
Integer id)
className - id -
Object getEntity(AdaptrexSession session,
Class<?> clazz,
Integer id)
class - id -
Object saveEntity(AdaptrexSession session,
Object entity)
entity -
Object deleteEntity(AdaptrexSession session,
String className,
Integer id)
className - id -
Object getNativeSession()
void closeNativeSession(Object session)
void shutdown()
boolean isIdField(Class<?> clazz,
String fieldName)
boolean isOneToMany(Class<?> clazz,
String fieldName)
boolean isManyToOne(Class<?> clazz,
String fieldName)
Object getFieldValue(Object entity,
String fieldName)
String getFieldType(Class<?> clazz,
String fieldName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||