Package io.jmix.data
Interface ReferenceIdProvider
- All Known Implementing Classes:
- EclipselinkReferenceIdProvider
public interface ReferenceIdProvider
Enables working with references to entities without loading them from the database.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classA wrapper for the reference ID value returned bygetReferenceId(Object, String)method.
- 
Method SummaryModifier and TypeMethodDescriptiongetReferenceId(Object entity, String property) Returns an ID of directly referenced entity without loading it from DB.
- 
Method Details- 
getReferenceIdReturns 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.RefIdwill haveReferenceIdProvider.RefId.isLoaded()= false.Usage example: ReferenceIdProvider.RefId refId = referenceIdProvider.getReferenceId(doc, "currency"); if (refId.isLoaded()) { String currencyCode = (String) refId.getValue(); }- Parameters:
- entity- entity instance in managed state
- property- name of reference property
- Returns:
- ReferenceIdProvider.RefIdinstance which contains the referenced entity ID
- Throws:
- IllegalArgumentException- if the specified property is not a reference
- IllegalStateException- if the entity is not in Managed state
- RuntimeException- if anything goes wrong when retrieving the ID
 
 
-