@Override
	public void commit() {
		
		for(Entity entity: entities.keySet()) {
			
			switch(entity.getState()) {
			
			case Changed:
				entities.get(entity).persistUpdate(entity);
				break;
			case Deleted:
				entities.get(entity).persistDelete(entity);
				break;
			case New:
				entities.get(entity).persistAdd(entity);
				break;
			case Unchanged:
				break;
			default:
				break;
			
			}
		}
			try {
				connection.commit();
				entities.clear();	
			} catch (SQLException e) {
				e.printStackTrace();
			}
	}