Package io.jmix.eclipselink.impl
Class EclipselinkReferenceIdProvider
java.lang.Object
io.jmix.eclipselink.impl.EclipselinkReferenceIdProvider
- All Implemented Interfaces:
ReferenceIdProvider
@Component("eclipselink_EclipselinkReferenceIdProvider")
public class EclipselinkReferenceIdProvider
extends Object
implements ReferenceIdProvider
Utility class to provide common functionality related to persistence.
Implemented as Spring bean to allow extension in application projects.
Implemented as Spring bean to allow extension in application projects.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.data.ReferenceIdProvider
ReferenceIdProvider.RefId
-
Field Summary
Modifier and TypeFieldDescriptionprotected javax.persistence.EntityManager
protected EntityStates
protected Metadata
protected MetadataTools
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetReferenceId
(Object entity, String property) Returns an ID of directly referenced entity without loading it from DB.
-
Field Details
-
entityStates
-
metadata
-
metadataTools
-
entityManager
protected javax.persistence.EntityManager entityManager
-
-
Constructor Details
-
EclipselinkReferenceIdProvider
public EclipselinkReferenceIdProvider()
-
-
Method Details
-
getReferenceId
Description copied from interface:ReferenceIdProvider
Returns an ID of directly referenced entity without loading it from DB.If the fetchPlan does not contain the reference and
FetchPlan.loadPartialEntities()
is true, the returnedReferenceIdProvider.RefId
will haveReferenceIdProvider.RefId.isLoaded()
= false.Usage example:
ReferenceIdProvider.RefId refId = referenceIdProvider.getReferenceId(doc, "currency"); if (refId.isLoaded()) { String currencyCode = (String) refId.getValue(); }
- Specified by:
getReferenceId
in interfaceReferenceIdProvider
- Parameters:
entity
- entity instance in managed stateproperty
- name of reference property- Returns:
ReferenceIdProvider.RefId
instance which contains the referenced entity ID
-