Class localHomeClass = manager.getComponent().getLocalHomeClass();
//
// findByPrimaryKey
//
JDBCEntityBridge entity = (JDBCEntityBridge) manager.getEntityBridge();
if (homeClass != null) {
try {
// try to get the finder method on the home interface
Method method = homeClass.getMethod(FIND_BY_PK, new Class[]{entity.getPrimaryKeyClass()});
JDBCQueryMetaData findByPKMD = manager.getMetaData().getQueryMetaDataForMethod(method);
JDBCReadAheadMetaData readAhead = (findByPKMD == null ?
entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead());
// got it add it to known finders
JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(
method,
readAhead,
entity.getMetaData().getQlCompiler(),
false
);
knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));
if (log.isDebugEnabled())
log.debug("Added findByPrimaryKey query command for home interface");
} catch (NoSuchMethodException e) {
throw new RuntimeException("Home interface does not have a findByPrimaryKey method");
}
}
if (localHomeClass != null) {
Method method;
try {
// try to get the finder method on the local home interface
method = localHomeClass.getMethod(FIND_BY_PK, new Class[]{entity.getPrimaryKeyClass()});
} catch (NoSuchMethodException e) {
throw new RuntimeException("Local home interface does " +
"not have the method findByPrimaryKey(" +
entity.getPrimaryKeyClass().getName() + ")");
}
// got it add it to known finders
JDBCQueryMetaData findByPKMD = manager.getMetaData().getQueryMetaDataForMethod(method);
JDBCReadAheadMetaData readAhead = (findByPKMD == null ?
entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead());
JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method, readAhead, entity.getMetaData().getQlCompiler(), false);
knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));
if (log.isDebugEnabled())
log.debug("Added findByPrimaryKey query command for local home interface");
}