/** * INTERNAL: * Return the referenced descriptor. */ public ClassDescriptor getClassDescriptor() { return getDescriptor(); }
/** * INTERNAL: * Initialize the fetch groups. */ public void initialize(AbstractSession session) throws DescriptorException { if (!(Helper.classImplementsInterface(getDescriptor().getJavaClass(), ClassConstants.FetchGroupTracker_class))) { //to use fetch group, the domain class must implement FetchGroupTracker interface session.getIntegrityChecker().handleError(DescriptorException.needToImplementFetchGroupTracker(getDescriptor().getJavaClass(), getDescriptor())); } if (getDefaultFetchGroup() == null) { // Check for lazy mappings to build default fetch group. FetchGroup fetchGroup = new FetchGroup(); boolean hasLazy = false; for (DatabaseMapping mapping : getDescriptor().getMappings()) { if (mapping.isForeignReferenceMapping() || (!mapping.isLazy())) { fetchGroup.addAttribute(mapping.getAttributeName()); } else { hasLazy = true; } } if (hasLazy) { setDefaultFetchGroup(fetchGroup); } } }
for (Iterator iterator = getDescriptor().getObjectBuilder().getPrimaryKeyMappings().iterator(); iterator.hasNext();) { DatabaseMapping mapping = (DatabaseMapping)iterator.next(); query.getFetchGroup().addAttribute(mapping.getAttributeName()); if (query.shouldMaintainCache() && getDescriptor().usesOptimisticLocking()) { DatabaseField lockField = getDescriptor().getOptimisticLockingPolicy().getWriteLockField(); if (lockField != null) { DatabaseMapping lockMapping = getDescriptor().getObjectBuilder().getMappingForField(lockField); if (lockMapping != null) { query.getFetchGroup().addAttribute(lockMapping.getAttributeName());
protected void initNonReferenceEntityFetchGroup() { FetchGroup nonReferenceFetchGroup = new FetchGroup(); for (DatabaseMapping mapping : getDescriptor().getMappings()) { if(!mapping.isForeignReferenceMapping()) { String name = mapping.getAttributeName(); if(this.defaultEntityFetchGroup == null || this.defaultEntityFetchGroup.containsAttribute(name)) { nonReferenceFetchGroup.addAttribute(name); } } } this.addMinimalFetchGroup(nonReferenceFetchGroup); this.nonReferenceEntityFetchGroup = getEntityFetchGroup(nonReferenceFetchGroup); }
protected void initNonReferenceEntityFetchGroup() { FetchGroup nonReferenceFetchGroup = new FetchGroup(); for (DatabaseMapping mapping : getDescriptor().getMappings()) { if(!mapping.isForeignReferenceMapping()) { String name = mapping.getAttributeName(); if(this.defaultEntityFetchGroup == null || this.defaultEntityFetchGroup.containsAttribute(name)) { nonReferenceFetchGroup.addAttribute(name); } } } this.addMinimalFetchGroup(nonReferenceFetchGroup); this.nonReferenceEntityFetchGroup = getEntityFetchGroup(nonReferenceFetchGroup); }
this.entityFetchGroups = new ConcurrentHashMap(); if (!(Helper.classImplementsInterface(getDescriptor().getJavaClass(), ClassConstants.FetchGroupTracker_class))) { session.getIntegrityChecker().handleError(DescriptorException.needToImplementFetchGroupTracker(getDescriptor().getJavaClass(), getDescriptor())); for (DatabaseMapping mapping : getDescriptor().getMappings()) { String name = mapping.getAttributeName(); if(mapping.isPrimaryKeyMapping()) { DatabaseField lockField = this.descriptor.getOptimisticLockingPolicy().getWriteLockField(); if (lockField != null) { DatabaseMapping lockMapping = getDescriptor().getObjectBuilder().getMappingForField(lockField); if (lockMapping != null) { String attributeName = lockMapping.getAttributeName();
this.entityFetchGroups = new ConcurrentHashMap(); if (!(Helper.classImplementsInterface(getDescriptor().getJavaClass(), ClassConstants.FetchGroupTracker_class))) { session.getIntegrityChecker().handleError(DescriptorException.needToImplementFetchGroupTracker(getDescriptor().getJavaClass(), getDescriptor())); for (DatabaseMapping mapping : getDescriptor().getMappings()) { String name = mapping.getAttributeName(); if(mapping.isPrimaryKeyMapping()) { DatabaseField lockField = this.descriptor.getOptimisticLockingPolicy().getWriteLockField(); if (lockField != null) { DatabaseMapping lockMapping = getDescriptor().getObjectBuilder().getMappingForField(lockField); if (lockMapping != null) { String attributeName = lockMapping.getAttributeName();
if (!(Helper.classImplementsInterface(getDescriptor().getJavaClass(), ClassConstants.FetchGroupTracker_class))) { for (DatabaseMapping mapping : getDescriptor().getMappings()) { if (mapping.isForeignReferenceMapping() || (!mapping.isLazy())) { defaultCandidate.addAttribute(mapping.getAttributeName());
if (!(Helper.classImplementsInterface(getDescriptor().getJavaClass(), ClassConstants.FetchGroupTracker_class))) { for (DatabaseMapping mapping : getDescriptor().getMappings()) { if (mapping.isForeignReferenceMapping() || (!mapping.isLazy())) { defaultCandidate.addAttribute(mapping.getAttributeName());
if (fg == null && getDescriptor().isChildDescriptor()) { ClassDescriptor current = this.descriptor;
if (fg == null && getDescriptor().isChildDescriptor()) { ClassDescriptor current = this.descriptor;
for (DatabaseMapping mapping : getDescriptor().getMappings()) { if(!mapping.isForeignReferenceMapping()) { String name = mapping.getAttributeName();
for (DatabaseMapping mapping : getDescriptor().getMappings()) { if(!mapping.isForeignReferenceMapping()) { String name = mapping.getAttributeName();