/* */ {
/* */ try
/* */ {
/* 157 */ Method method = homeClass.getMethod("findByPrimaryKey", new Class[] { entity.getPrimaryKeyClass() });
/* */
/* 159 */ JDBCQueryMetaData findByPKMD = this.manager.getMetaData().getQueryMetaDataForMethod(method);
/* 160 */ JDBCReadAheadMetaData readAhead = findByPKMD == null ? entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead();
/* */
/* 164 */ JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method, readAhead, entity.getMetaData().getQLCompiler(), false);
/* */
/* 170 */ this.knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));
/* */
/* 172 */ if (log.isDebugEnabled())
/* 173 */ log.debug("Added findByPrimaryKey query command for home interface");
/* */ }
/* */ catch (NoSuchMethodException e) {
/* 176 */ throw new DeploymentException("Home interface does not have a findByPrimaryKey method");
/* */ }
/* */ }
/* */
/* 180 */ if (localHomeClass != null)
/* */ {
/* */ Method method;
/* */ try
/* */ {
/* 187 */ method = localHomeClass.getMethod("findByPrimaryKey", new Class[] { entity.getPrimaryKeyClass() });
/* */ }
/* */ catch (NoSuchMethodException e) {
/* 190 */ throw new DeploymentException("Local home interface does not have the method findByPrimaryKey(" + entity.getPrimaryKeyClass().getName() + ")");
/* */ }
/* */
/* 196 */ JDBCQueryMetaData findByPKMD = this.manager.getMetaData().getQueryMetaDataForMethod(method);
/* 197 */ JDBCReadAheadMetaData readAhead = findByPKMD == null ? entity.getMetaData().getReadAhead() : findByPKMD.getReadAhead();
/* */
/* 199 */ JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method, readAhead, entity.getMetaData().getQLCompiler(), false);
/* 200 */ this.knownQueries.put(method, factory.createFindByPrimaryKeyQuery(q));
/* */
/* 202 */ if (log.isDebugEnabled()) {
/* 203 */ log.debug("Added findByPrimaryKey query command for local home interface");
/* */ }
/* */
/* */ }
/* */
/* 209 */ Class ejbClass = this.manager.getMetaData().getEntityClass();
/* */
/* 211 */ Method[] customMethods = ejbClass.getMethods();
/* 212 */ for (int i = 0; i < customMethods.length; i++)
/* */ {
/* 214 */ Method m = customMethods[i];
/* 215 */ String methodName = m.getName();
/* 216 */ if (!methodName.startsWith("ejbFind"))
/* */ continue;
/* 218 */ String interfaceName = 'f' + methodName.substring(4);
/* */
/* 220 */ if (homeClass != null)
/* */ {
/* */ try
/* */ {
/* 225 */ Method interfaceMethod = homeClass.getMethod(interfaceName, m.getParameterTypes());
/* */
/* 230 */ this.knownQueries.put(interfaceMethod, new JDBCCustomFinderQuery(this.manager, m));
/* */
/* 232 */ if (log.isDebugEnabled()) {
/* 233 */ log.debug("Added custom finder " + methodName + " on home interface");
/* */ }
/* */ }
/* */ catch (NoSuchMethodException e)
/* */ {
/* */ }
/* */ }
/* 240 */ if (localHomeClass == null) {
/* */ continue;
/* */ }
/* */ try
/* */ {
/* 245 */ Method interfaceMethod = localHomeClass.getMethod(interfaceName, m.getParameterTypes());
/* */
/* 250 */ this.knownQueries.put(interfaceMethod, new JDBCCustomFinderQuery(this.manager, m));
/* */
/* 252 */ if (log.isDebugEnabled()) {
/* 253 */ log.debug("Added custom finder " + methodName + " on local home interface");
/* */ }
/* */
/* */ }
/* */ catch (NoSuchMethodException e)
/* */ {
/* */ }
/* */
/* */ }
/* */
/* 265 */ Iterator definedFinders = this.manager.getMetaData().getQueries().iterator();
/* 266 */ while (definedFinders.hasNext())
/* */ {
/* 268 */ JDBCQueryMetaData q = (JDBCQueryMetaData)definedFinders.next();
/* */
/* 270 */ if (!this.knownQueries.containsKey(q.getMethod()))
/* */ {
/* 272 */ if ((q instanceof JDBCJBossQLQueryMetaData))
/* */ {
/* 274 */ this.knownQueries.put(q.getMethod(), factory.createJBossQLQuery(q));
/* */ }
/* 276 */ else if ((q instanceof JDBCDynamicQLQueryMetaData))
/* */ {
/* 278 */ this.knownQueries.put(q.getMethod(), factory.createDynamicQLQuery(q));
/* */ }
/* 280 */ else if ((q instanceof JDBCDeclaredQueryMetaData))
/* */ {
/* 282 */ this.knownQueries.put(q.getMethod(), factory.createDeclaredSQLQuery(q));
/* */ }
/* 284 */ else if ((q instanceof JDBCQlQueryMetaData))
/* */ {
/* 286 */ this.knownQueries.put(q.getMethod(), factory.createEJBQLQuery(q));
/* */ }
/* */
/* */ }
/* */
/* */ }