String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/jnex/testDatabase.mdb;DriverID=22;READONLY=true}"; // add on to the end
JdbcConnectionHandler.init(new JdbcConnectionHandler(database, null, null));
//DatabaseTableMapping itemMapping = DatabaseTableMapping.createStandardMapping(new ItemModel());
DatabaseTableMapping itemMapping = new DatabaseTableMapping(ItemModel.FIELD_NAME, "PK",
new String[]{ItemModel.FIELD_booleanField,
ItemModel.FIELD_dateField,
ItemModel.FIELD_doubleField,
ItemModel.FIELD_intField,
ItemModel.FIELD_stringField,
ItemModel.FIELD_timeField,
ItemSubStructure.FIELD_NAME + DataModel.FIELD_NAME_SEPARATOR_CHAR + ItemSubStructure.FIELD_s1,
ItemSubStructure.FIELD_NAME + DataModel.FIELD_NAME_SEPARATOR_CHAR + ItemSubStructure.FIELD_s2,
ItemSubStructure.FIELD_NAME + DataModel.FIELD_NAME_SEPARATOR_CHAR + ItemSubStructure.FIELD_bool,
ItemSubStructure.FIELD_NAME + DataModel.FIELD_NAME_SEPARATOR_CHAR + ItemSubStructure.FIELD_combo,
},
new String[]{ItemModel.FIELD_booleanField,
ItemModel.FIELD_dateField,
ItemModel.FIELD_doubleField,
ItemModel.FIELD_intField,
ItemModel.FIELD_stringField,
ItemModel.FIELD_timeField,
ItemSubStructure.FIELD_s1,
ItemSubStructure.FIELD_s2,
ItemSubStructure.FIELD_bool,
ItemSubStructure.FIELD_combo,
}
);
itemMapping.registerTranslator(new DatabaseFieldTranslator() {
public StringVector getFieldList() {
return new StringVector(new String[] {ItemModel.FIELD_comboBoxField});
}
public void setModelValues(DatabaseTableMapping mapping, JnexPreparedStatement statement, int indexOfFirstField, DataModel model) {