result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_REFID,
finderArgs, this);
}
if (result instanceof LFTincanPackage) {
LFTincanPackage lfTincanPackage = (LFTincanPackage) result;
if (!Validator.equals(assetRefID, lfTincanPackage.getAssetRefID())) {
result = null;
}
}
if (result == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_SELECT_LFTINCANPACKAGE_WHERE);
if (assetRefID == null) {
query.append(_FINDER_COLUMN_REFID_ASSETREFID_NULL_2);
} else {
query.append(_FINDER_COLUMN_REFID_ASSETREFID_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (assetRefID != null) {
qPos.add(assetRefID.longValue());
}
List<LFTincanPackage> list = q.list();
if (list.isEmpty()) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_REFID,
finderArgs, list);
} else {
if ((list.size() > 1) && _log.isWarnEnabled()) {
_log.warn(
"LFTincanPackagePersistenceImpl.fetchByRefID(Long, boolean) with parameters (" +
StringUtil.merge(finderArgs) +
") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder.");
}
LFTincanPackage lfTincanPackage = list.get(0);
result = lfTincanPackage;
cacheResult(lfTincanPackage);
if ((lfTincanPackage.getAssetRefID() != assetRefID)) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_REFID,
finderArgs, lfTincanPackage);
}
}
} catch (Exception e) {