* @param store The store manager.
* @return A RetrieveDescriptor selecting a pc instance by pk-fields.
* @see #getRetrieveDescForFKQuery
*/
public RetrieveDesc getRetrieveDescForPKQuery(FieldDesc additionalField, PersistenceStore store) {
RetrieveDescImpl rd = null;
String cacheKey = generateRDCacheKey(additionalField);
synchronized (retrieveDescCache) {
// Cache lookup.
rd = (RetrieveDescImpl) retrieveDescCache.get(cacheKey);
// Generate a new RD if there isn't one be found in the cache.
if (rd == null) {
rd = (RetrieveDescImpl) store.getRetrieveDesc(pcClass);
if (additionalField != null) {
RetrieveDesc frd = null;
String name = additionalField.getName();
// If the additionalField is not null, we will retrieve
// the field indicated by it along with the query.
if (additionalField instanceof ForeignFieldDesc) {
Class additionalClass = ((ForeignFieldDesc) additionalField).
foreignConfig.getPersistenceCapableClass();
frd = store.getRetrieveDesc(additionalClass);
}
rd.addPrefetchedField(name, frd);
}
addPKConstraints(rd);
// Cache fillup.
retrieveDescCache.put(cacheKey, rd);