@Override
public Automotriz getAutomoriz(int id) throws Exception {
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Automotriz> query = builder.createQuery(Automotriz.class);
Root<Automotriz> automotriz = query.from(Automotriz.class);
query.select(automotriz);
TypedQuery<Automotriz> typedQuery = entityManager.createQuery(query);
query.where(builder.gt(automotriz.get("id_automotriz"), id));
return (Automotriz) typedQuery.getResultList().get(id-1);
}