|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.azzyzt.jee.runtime.eao.IdTranslator
public class IdTranslator
When a graph of new but connected objects is persisted, the DTOs can't be connected by each other's IDs, because at that time no object has an ID yet. Instead of real IDs we use temporary negative proxy ID values and translate them on the fly.
ID translation happens inside of the generated converters. MultiObjectSaver
creates one instance of IdTranslator
and then traverses the list of DTOs.
For each DTO it creates or uses an already existing converter, passing the common
translator into the converters. The DTOs are expected to be in an order such that
no proxy ID is referenced, that is not already defined.
MultiObjectSaver
Constructor Summary | |
---|---|
IdTranslator()
|
Method Summary | |
---|---|
void |
addTranslation(java.lang.Number proxy,
java.lang.Object value)
|
java.lang.Object |
translate(java.lang.Number proxy)
Translates a proxy ID to a real ID. |
java.lang.Object |
translate(java.io.Serializable embeddedId)
Translates the IDs in an embedded ID. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IdTranslator()
Method Detail |
---|
public void addTranslation(java.lang.Number proxy, java.lang.Object value) throws DuplicateProxyIdException
proxy
- a negative proxy ID valuevalue
- a positive real ID value
DuplicateProxyIdException
public java.lang.Object translate(java.lang.Number proxy) throws InvalidProxyIdException
null
or positive,
the proxy is returned. If no translation for a negative proxy value is found, an
exception is thrown. This could be due to a wrong order of the DTO list.
proxy
- a negative proxy ID value or null
null
InvalidProxyIdException
public java.lang.Object translate(java.io.Serializable embeddedId) throws InvalidProxyIdException, InvalidIdException
embeddedId
- an embedded ID
InvalidProxyIdException
InvalidIdException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |