class Model implements Getter,ValidatableBean,JsonStringable {

    @SuppressWarnings("rawtypes")
	protected void doSetId(Object id){
		_init();
		String[] keyNames = em.getKeyFieldNames();
		if(keyNames.length == 1){
			doSet(keyNames[0],id);
			return;
		}
		
		if(keyNames.length == 0){
			throw new IllegalStateException("Model '" + getEntityName() + "' has no id fields");
		}
		
		if(id == null){
			for(int i=0;i<keyNames.length;i++){
				doSet(keyNames[i],null);
			}
		}else{
			if(!(id instanceof Map)){
				throw new IllegalArgumentException("The given id must be a Map object for composite id model");
			}
            Map map = (Map)id;
			for(int i=0;i<keyNames.length;i++){
				doSet(keyNames[i], map.get(keyNames[i]));
			}
		}
    }

    public  Model();

}