|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.azzyzt.jee.runtime.eao.EaoBase
public abstract class EaoBase
The abstract base class of the generated generic entity access objects. The generated generic EAO is a stateless session bean, and its only purpose is to be a target for injection. All interaction with JPA happens here.
Constructor Summary | |
---|---|
EaoBase()
|
Method Summary | ||
---|---|---|
|
all(java.lang.Class<T> clazz)
Returns all entities of a certain class |
|
|
allOrdered(java.lang.Class<T> clazz,
OrderByClause orderBy)
Returns all entities of a certain class, ordered according to an OrderByClause . |
|
|
delete(java.lang.Class<T> clazz,
I id)
Deletes an entity of a given class and ID. |
|
void |
delete(java.lang.Object id,
java.lang.Class<?> clazz)
Another version needed in cases when we are definite about the classes, but have no way to prove it to the compiler. |
|
|
deleteByName(java.lang.Class<T> clazz,
java.lang.String nameWc)
Deletes all entities with a name matching a certain wildcard. |
|
|
findOrCreate(java.lang.Class<T> clazz,
I id)
Fetches an entity by ID or, if it does not exist, creates it. |
|
|
findOrFail(java.lang.Class<T> clazz,
I id)
Fetches an entity by ID or, if it does not exist, fails with an exception. |
|
java.lang.Object |
findOrFail(java.lang.Object id,
java.lang.Class<?> clazz)
A raw version of findOrFail(Class, Object) needed in cases when we are definite about the classes,
but have no way to prove it to the compiler. |
|
|
findOrInvalidId(java.lang.Class<T> clazz,
I id)
Fetches an entity by ID or, if the ID is invalid or null , fails. |
|
|
findOrNull(java.lang.Class<T> clazz,
I id)
Fetches an entity by ID or, if not found, returns null . |
|
void |
flush()
|
|
abstract javax.persistence.EntityManager |
getEm()
The EntityManager is injected into the concrete generated
child class. |
|
|
list(QuerySpec qs,
java.lang.Class<T> clazz,
TypeMetaInfoInterface tmi)
Returns the result of a typed query. |
|
|
persist(T entity)
Stores an entity. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EaoBase()
Method Detail |
---|
public abstract javax.persistence.EntityManager getEm()
EntityManager
is injected into the concrete generated
child class. This abstract method lets the generic methods access the
persistence context.
EntityManager
public void flush()
public <I,T extends EntityBase<I>> T findOrFail(java.lang.Class<T> clazz, I id) throws EntityNotFoundException
clazz
- an entity classid
- the ID of an entity
EntityNotFoundException
public java.lang.Object findOrFail(java.lang.Object id, java.lang.Class<?> clazz) throws EntityNotFoundException
findOrFail(Class, Object)
needed in cases when we are definite about the classes,
but have no way to prove it to the compiler. Used for the "delete" part
of "storeDelete()".
Order changed because of otherwise identical erasure.
clazz
- an entity classid
- the ID of an entity
EntityNotFoundException
public <I,T extends EntityBase<I>> T findOrCreate(java.lang.Class<T> clazz, I id) throws EntityNotFoundException, EntityInstantiationException
clazz
- an entity classid
- the ID of an entity
EntityNotFoundException
EntityInstantiationException
public <I,T extends EntityBase<I>> T findOrInvalidId(java.lang.Class<T> clazz, I id) throws EntityNotFoundException, InvalidIdException
null
, fails.
clazz
- an entity classid
- the ID of an entity
EntityNotFoundException
InvalidIdException
public <I,T extends EntityBase<I>> T findOrNull(java.lang.Class<T> clazz, I id) throws InvalidIdException
null
.
clazz
- an entity classid
- the ID of an entity
null
InvalidIdException
public <I,T extends EntityBase<I>> void persist(T entity)
entity
- the entitypublic <I,T extends EntityBase<I>> void delete(java.lang.Class<T> clazz, I id) throws EntityNotFoundException
clazz
- an entity classid
- the ID of an entity
EntityNotFoundException
public void delete(java.lang.Object id, java.lang.Class<?> clazz) throws EntityNotFoundException
id
- the ID of an entityclazz
- an entity class
EntityNotFoundException
public <I,T extends EntityBase<I>> void deleteByName(java.lang.Class<T> clazz, java.lang.String nameWc)
clazz
- an entity classnameWc
- a name wildcard stringpublic <I,T extends EntityBase<I>> java.util.List<T> all(java.lang.Class<T> clazz)
clazz
- an entity class
public <I,T extends EntityBase<I>> java.util.List<T> list(QuerySpec qs, java.lang.Class<T> clazz, TypeMetaInfoInterface tmi) throws InvalidFieldException, AccessDeniedException, QuerySyntaxException, NotYetImplementedException
QueryBuilder
from
a QuerySpec
.
qs
- a query specificationclazz
- an entity classtmi
- type meta information generated by Azzyzt JEE Tools
InvalidFieldException
AccessDeniedException
QuerySyntaxException
NotYetImplementedException
public <I,T extends EntityBase<I>> java.util.List<T> allOrdered(java.lang.Class<T> clazz, OrderByClause orderBy)
OrderByClause
.
clazz
- an entity classorderBy
- an OrderByClause
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |