/********************* ORM support functions ************************/
public void writeObjectToDatabase(Object object) throws IllegalAccessException {
Field[] declaredFields = object.getClass().getDeclaredFields();
Arrays.sort(declaredFields, new FieldComparator()); //Performance issue, cache sorted fields
Record record = createRecord(database.pointer, declaredFields.length);
for (int i = 0; i < declaredFields.length; i++) {
Integer value = getFieldValue(object, declaredFields[i]);
System.out.println("Writing field: [" + declaredFields[i].getName() + "] with value: " + value);