This commit is contained in:
Mark Johnson
2007-06-12 22:30:48 +00:00
parent 2532edba80
commit 41acbbdeca
@@ -3,7 +3,7 @@
// //
// samskivert library - useful routines for java programs // samskivert library - useful routines for java programs
// Copyright (C) 2006 Michael Bayne, Pär Winzell // Copyright (C) 2006 Michael Bayne, Pär Winzell
// //
// This library is free software; you can redistribute it and/or modify it // This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published // under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or // by the Free Software Foundation; either version 2.1 of the License, or
@@ -88,6 +88,9 @@ public abstract class FieldMarshaller
} else if (ftype.equals(byte[].class)) { } else if (ftype.equals(byte[].class)) {
marshaller = new ByteArrayMarshaller(); marshaller = new ByteArrayMarshaller();
} else if (ftype.equals(int[].class)) {
marshaller = new IntArrayMarshaller();
// SQL types // SQL types
} else if (ftype.equals(Date.class) || } else if (ftype.equals(Date.class) ||
ftype.equals(Time.class) || ftype.equals(Time.class) ||
@@ -124,7 +127,7 @@ public abstract class FieldMarshaller
{ {
return _computed; return _computed;
} }
/** /**
* Returns the GeneratedValue annotation on this field, if any. * Returns the GeneratedValue annotation on this field, if any.
*/ */
@@ -405,6 +408,20 @@ public abstract class FieldMarshaller
} }
} }
protected static class IntArrayMarshaller extends FieldMarshaller {
public void setValue (Object po, PreparedStatement ps, int column)
throws SQLException, IllegalAccessException {
ps.setObject(column, _field.get(po));
}
public void getValue (ResultSet rs, Object po)
throws SQLException, IllegalAccessException {
_field.set(po, rs.getObject(getColumnName()));
}
public String getColumnType () {
return "BLOB";
}
}
protected static class ByteEnumMarshaller extends FieldMarshaller { protected static class ByteEnumMarshaller extends FieldMarshaller {
public ByteEnumMarshaller (Class clazz) { public ByteEnumMarshaller (Class clazz) {
try { try {