18 package com.mysql.clusterj.openjpa;
20 import com.mysql.clusterj.ColumnMetadata;
21 import com.mysql.clusterj.core.spi.DomainTypeHandler;
22 import com.mysql.clusterj.core.spi.ValueHandler;
23 import com.mysql.clusterj.core.util.Logger;
24 import com.mysql.clusterj.core.util.LoggerFactoryService;
25 import java.math.BigDecimal;
26 import java.math.BigInteger;
29 import java.sql.Timestamp;
30 import java.util.BitSet;
31 import org.apache.openjpa.kernel.OpenJPAStateManager;
38 protected OpenJPAStateManager sm;
45 protected OpenJPAStateManager getStateManager() {
62 public boolean isNull(
int fieldNumber) {
63 return (sm.fetchObject(fieldNumber) == null);
66 public boolean isModified(
int fieldNumber) {
67 BitSet modified = sm.getDirty();
68 return modified.get(fieldNumber);
71 public void resetModified() {
72 throw new UnsupportedOperationException(
"Not supported yet.");
75 public void markModified(
int fieldNumber) {
76 throw new UnsupportedOperationException(
"Not supported yet.");
79 public boolean getBoolean(
int fieldNumber) {
80 return sm.fetchBoolean(fieldNumber);
83 public boolean[] getBooleans(
int fieldNumber) {
84 throw new UnsupportedOperationException(
"Not supported yet.");
87 public Boolean getObjectBoolean(
int fieldNumber) {
88 return sm.fetchBoolean(fieldNumber);
91 public byte getByte(
int fieldNumber) {
92 return sm.fetchByte(fieldNumber);
95 public byte[] getBytes(
int fieldNumber) {
96 return (byte[])sm.fetchObject(fieldNumber);
99 public short getShort(
int fieldNumber) {
100 return sm.fetchShort(fieldNumber);
103 public int getInt(
int fieldNumber) {
104 int value = sm.fetchInt(fieldNumber);
105 if (logger.isDetailEnabled()) logger.detail(
" fieldNumber: " + fieldNumber +
" value: " + value);
109 public long getLong(
int fieldNumber) {
110 long value = sm.fetchLong(fieldNumber);
111 if (logger.isDetailEnabled()) logger.detail(
" fieldNumber: " + fieldNumber +
" value: " + value);
115 public float getFloat(
int fieldNumber) {
116 return sm.fetchFloat(fieldNumber);
119 public double getDouble(
int fieldNumber) {
120 return sm.fetchDouble(fieldNumber);
123 public Byte getObjectByte(
int fieldNumber) {
124 return (Byte)sm.fetchObject(fieldNumber);
127 public Short getObjectShort(
int fieldNumber) {
128 return (Short)sm.fetchObject(fieldNumber);
131 public Integer getObjectInt(
int fieldNumber) {
132 Integer value = (Integer)sm.fetchObject(fieldNumber);
133 if (logger.isDetailEnabled()) logger.detail(
" fieldNumber: " + fieldNumber +
" value: " + value);
137 public Long getObjectLong(
int fieldNumber) {
138 return (Long)sm.fetchObject(fieldNumber);
141 public Float getObjectFloat(
int fieldNumber) {
142 return (Float)sm.fetchObject(fieldNumber);
145 public Double getObjectDouble(
int fieldNumber) {
146 return (Double)sm.fetchObject(fieldNumber);
149 public BigDecimal getBigDecimal(
int fieldNumber) {
150 return (BigDecimal)sm.fetchObject(fieldNumber);
153 public BigInteger getBigInteger(
int fieldNumber) {
154 return (BigInteger)sm.fetchObject(fieldNumber);
157 public String getString(
int fieldNumber) {
158 return sm.fetchString(fieldNumber);
161 public Date getJavaSqlDate(
int fieldNumber) {
162 return (java.sql.Date)sm.fetchObject(fieldNumber);
165 public java.util.Date getJavaUtilDate(
int fieldNumber) {
166 return (java.util.Date)sm.fetchObject(fieldNumber);
169 public Time getJavaSqlTime(
int fieldNumber) {
170 return (java.sql.Time)sm.fetchObject(fieldNumber);
173 public Timestamp getJavaSqlTimestamp(
int fieldNumber) {
174 return (java.sql.Timestamp)sm.fetchObject(fieldNumber);
177 public void setBoolean(
int fieldNumber,
boolean value) {
178 sm.storeBoolean(fieldNumber, value);
181 public void setBooleans(
int fieldNumber,
boolean[] value) {
182 sm.storeObject(fieldNumber, value);
185 public void setByte(
int fieldNumber, byte value) {
186 sm.storeByte(fieldNumber, value);
189 public void setBytes(
int fieldNumber, byte[] value) {
190 sm.storeObject(fieldNumber, value);
193 public void setShort(
int fieldNumber,
short value) {
194 sm.storeShort(fieldNumber, value);
197 public void setInt(
int fieldNumber,
int value) {
198 if (logger.isDetailEnabled()) logger.detail(
" fieldNumber: " + fieldNumber +
" value: " + value);
200 sm.storeInt(fieldNumber, value);
203 public void setLong(
int fieldNumber,
long value) {
204 sm.storeLong(fieldNumber, value);
207 public void setFloat(
int fieldNumber,
float value) {
208 sm.storeFloat(fieldNumber, value);
211 public void setDouble(
int fieldNumber,
double value) {
212 sm.storeDouble(fieldNumber, value);
215 public void setObjectBoolean(
int fieldNumber, Boolean value) {
216 sm.storeObject(fieldNumber, value);
219 public void setObjectByte(
int fieldNumber, Byte value) {
220 sm.storeObject(fieldNumber, value);
223 public void setObjectShort(
int fieldNumber, Short value) {
224 sm.storeObject(fieldNumber, value);
227 public void setObjectInt(
int fieldNumber, Integer value) {
228 if (logger.isDetailEnabled()) logger.detail(
" fieldNumber: " + fieldNumber +
" value: " + value);
229 sm.storeObject(fieldNumber, value);
232 public void setObjectLong(
int fieldNumber, Long value) {
233 sm.storeObject(fieldNumber, value);
236 public void setObjectFloat(
int fieldNumber, Float value) {
237 sm.storeObject(fieldNumber, value);
240 public void setObjectDouble(
int fieldNumber, Double value) {
241 sm.storeObject(fieldNumber, value);
244 public void setBigDecimal(
int fieldNumber, BigDecimal value) {
245 sm.storeObject(fieldNumber, value);
248 public void setBigInteger(
int fieldNumber, BigInteger value) {
249 sm.storeObject(fieldNumber, value);
252 public void setString(
int fieldNumber,
String value) {
253 sm.storeString(fieldNumber, value);
256 public void setObject(
int fieldNumber, Object value) {
257 sm.storeObject(fieldNumber, value);
260 public void setJavaSqlDate(
int fieldNumber, Date value) {
261 sm.storeObject(fieldNumber, value);
264 public void setJavaUtilDate(
int fieldNumber, java.util.Date value) {
265 sm.storeObject(fieldNumber, value);
268 public void setJavaSqlTime(
int fieldNumber, Time value) {
269 sm.storeObject(fieldNumber, value);
272 public void setJavaSqlTimestamp(
int fieldNumber, Timestamp value) {
273 sm.storeObject(fieldNumber, value);
276 public String pkToString(DomainTypeHandler<?> domainTypeHandler) {
278 int[] keys = domainTypeHandler.getKeyFieldNumbers();
281 sb.append(separator);
282 sb.append(sm.fetch(
i));
286 return sb.toString();
289 @SuppressWarnings(
"unused")
290 private void dumpStackTrace() {
291 Throwable t =
new Throwable();
295 public void found(Boolean found) {
296 throw new UnsupportedOperationException(
"Not supported yet.");
300 throw new UnsupportedOperationException(
"Not supported yet.");
303 public Boolean found() {
304 throw new UnsupportedOperationException(
"Not supported yet.");
307 public Object
get(
int columnNumber) {
308 throw new UnsupportedOperationException(
"Not supported yet.");
311 public void set(
int columnNumber, Object value) {
312 throw new UnsupportedOperationException(
"Not supported yet.");