1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.core.ojb;
17
18 import org.apache.ojb.broker.accesslayer.sql.SelectStatement;
19 import org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl;
20 import org.apache.ojb.broker.metadata.ClassDescriptor;
21 import org.apache.ojb.broker.platforms.Platform;
22 import org.apache.ojb.broker.query.Query;
23 import org.apache.ojb.broker.util.logging.Logger;
24 import org.apache.ojb.broker.util.logging.LoggerFactory;
25 import org.kuali.rice.core.util.RiceDebugUtils;
26
27
28
29
30
31
32
33
34
35
36
37
38
39 public class SqlGeneratorSuffixableImpl extends SqlGeneratorDefaultImpl {
40 private Logger logger = LoggerFactory.getLogger(SqlGeneratorSuffixableImpl.class);
41
42 public SqlGeneratorSuffixableImpl(Platform platform) {
43 super(platform);
44 }
45
46 @Override
47 public SelectStatement getPreparedSelectStatement(Query query, ClassDescriptor cld) {
48 SelectStatement sql = new SuffixedSqlSelectStatement(getPlatform(), cld, query, logger);
49 if (logger.isDebugEnabled()) {
50 boolean masochisticSqlLogging = true;
51 if ( masochisticSqlLogging ) {
52 StringBuffer sb = RiceDebugUtils.getTruncatedStackTrace( true );
53 logger.debug("SQL: " + sql.getStatement() + "\n" + query.getCriteria() + "\n" + sb.toString() );
54 } else {
55 logger.debug("SQL: " + sql.getStatement() );
56 }
57 }
58 return sql;
59 }
60 }