protected ResultSet getGeneratedKey(PreparedStatement ps) throws SQLException {
		
		ResultSet rs = null;
		
		try {
		
			if(db.getConnection().getMetaData().supportsGetGeneratedKeys()) {
				rs = ps.getGeneratedKeys();
			} else {
				
				if(Configuration.DatabaseType == DatabaseTypes.SQLITE) {
					// workaround: retrieve keys with 'select last_insert_rowid();'
					rs = ps.getGeneratedKeys();
				} else {
					throw new SQLException("driver does not support retrieving generated keys.");
				}
				
			}
		
		} catch (SQLException e) {
			log.log(Level.SEVERE, "getGeneratedKey failed: " + e.getMessage(), e);
			throw e;
		}
		
		
		return rs;
		
	}