public class Backend extends Object
Every Frontend needs a Backend. But a Backend can serve more than one Frontend.
The Backend keeps a repository that may only be accessed within a transaction. See EntityTransaction.
The Backend configuration must be done with system properties. These are handled in the initBackend method. The configuration cannot be changed during the lifetime of an application VM.
The configuration properties:
MjBackendAddress
and MjBackendPort
: if
these two are set the transactions are delegated to a remote
SocketBackendServer.MjBackend
: if this property is set it specifies
the classname of the Backend.Constructor and Description |
---|
Backend() |
Modifier and Type | Method and Description |
---|---|
static <T> long |
count(Class<T> clazz,
Criteria criteria) |
static Backend |
create() |
protected Authentication |
createAuthentication() |
static <T> int |
delete(Class<T> clazz,
Criteria criteria) |
static <T> void |
delete(T object) |
<T> T |
doExecute(Transaction<T> transaction) |
static <T> T |
execute(Transaction<T> transaction) |
static <T> List<T> |
find(Class<T> clazz,
Query query) |
Authentication |
getAuthentication() |
static Backend |
getInstance() |
Repository |
getRepository()
The backend repository may only be accessed within a transaction.
|
protected <T> void |
handleCodeCache(Transaction<T> transaction) |
static <T> Object |
insert(T object) |
boolean |
isAuthenticationActive() |
boolean |
isInTransaction() |
static <T> T |
read(Class<T> clazz,
Object id) |
static <T> T |
save(T object) |
static void |
setInstance(Backend instance) |
protected void |
setRepository(Repository repository) |
static <T> void |
update(T object) |
public static Backend create()
public static void setInstance(Backend instance)
public static Backend getInstance()
protected void setRepository(Repository repository)
public Repository getRepository()
IllegalStateException
- if currently no transaction is activeprotected Authentication createAuthentication()
public final Authentication getAuthentication()
public boolean isAuthenticationActive()
public boolean isInTransaction()
public static <T> Object insert(T object)
public static <T> void update(T object)
public static <T> T save(T object)
public static <T> void delete(T object)
public static <T> T execute(Transaction<T> transaction)
public <T> T doExecute(Transaction<T> transaction)
protected <T> void handleCodeCache(Transaction<T> transaction)
Copyright © 2019. All rights reserved.