1 22 package org.jboss.ejb.plugins.cmp.jdbc.metadata; 23 24 import java.lang.reflect.Method ; 25 26 import org.jboss.metadata.QueryMetaData; 27 28 34 public final class JDBCQlQueryMetaData implements JDBCQueryMetaData 35 { 36 39 private final Method method; 40 41 44 private final String ejbQl; 45 46 49 private final boolean resultTypeMappingLocal; 50 51 54 private final JDBCReadAheadMetaData readAhead; 55 56 private final Class compiler; 57 58 private final boolean lazyResultSetLoading; 59 60 68 public JDBCQlQueryMetaData(QueryMetaData queryMetaData, Method method, Class qlCompiler, boolean lazyResultSetLoading) 69 { 70 this.method = method; 71 this.readAhead = JDBCReadAheadMetaData.DEFAULT; 72 ejbQl = queryMetaData.getEjbQl(); 73 resultTypeMappingLocal = queryMetaData.getResultTypeMapping().equals(QueryMetaData.LOCAL); 74 75 compiler = qlCompiler; 76 this.lazyResultSetLoading = lazyResultSetLoading; 77 } 78 79 83 public JDBCQlQueryMetaData(JDBCQlQueryMetaData defaults, 84 JDBCReadAheadMetaData readAhead, 85 Class compiler, 86 boolean lazyResultSetLoading) 87 { 88 this.method = defaults.getMethod(); 89 this.readAhead = readAhead; 90 this.ejbQl = defaults.getEjbQl(); 91 this.resultTypeMappingLocal = defaults.resultTypeMappingLocal; 92 this.compiler = compiler; 93 this.lazyResultSetLoading = lazyResultSetLoading; 94 } 95 96 97 101 public JDBCQlQueryMetaData(JDBCQlQueryMetaData jdbcQueryMetaData, 102 Method method, 103 JDBCReadAheadMetaData readAhead) 104 { 105 this.method = method; 106 this.readAhead = readAhead; 107 ejbQl = jdbcQueryMetaData.getEjbQl(); 108 resultTypeMappingLocal = jdbcQueryMetaData.resultTypeMappingLocal; 109 compiler = jdbcQueryMetaData.compiler; 110 lazyResultSetLoading = jdbcQueryMetaData.lazyResultSetLoading; 111 } 112 113 public Method getMethod() 115 { 116 return method; 117 } 118 119 public Class getQLCompilerClass() 120 { 121 return compiler; 122 } 123 124 129 public String getEjbQl() 130 { 131 return ejbQl; 132 } 133 134 public boolean isResultTypeMappingLocal() 136 { 137 return resultTypeMappingLocal; 138 } 139 140 145 public JDBCReadAheadMetaData getReadAhead() 146 { 147 return readAhead; 148 } 149 150 public boolean isLazyResultSetLoading() 151 { 152 return lazyResultSetLoading; 153 } 154 155 164 public boolean equals(Object o) 165 { 166 if(o instanceof JDBCQlQueryMetaData) 167 { 168 return ((JDBCQlQueryMetaData) o).method.equals(method); 169 } 170 return false; 171 } 172 173 179 public int hashCode() 180 { 181 return method.hashCode(); 182 } 183 184 194 public String toString() 195 { 196 return "[JDBCQlQueryMetaData : method=" + method + "]"; 197 } 198 } 199 | Popular Tags |