Ejemplo:
query.setResultTransformer(new ResultTransformerUtil(DTO.class)).list();
import org.hibernate.transform.AliasToBeanResultTransformer; public class ResultTransformerUtil extends AliasToBeanResultTransformer{ private static final long serialVersionUID = -63993253786054062L; public ResultTransformerUtil(Class<?> resultClass) { super(resultClass); } @Override public Object transformTuple(Object[] tuple, String[] aliases) { String[] cleanedUpAliases = new String[aliases.length]; for (int i = 0; i < aliases.length; i++){ cleanedUpAliases[i] = aliases[i].replaceFirst("z", ""); } return super.transformTuple(tuple, cleanedUpAliases); } }
No hay comentarios:
Publicar un comentario