public void updateCarrito(CarritoDTO detail) { CarritoEntity entity = entityManager.merge(CarritoConverter.persistenceDTO2Entity(detail)); CarritoConverter.entity2PersistenceDTO(entity); }
@SuppressWarnings("unchecked") public List<CarritoDTO> getCarritos() { Query q = entityManager.createQuery("select u from CarritoEntity u"); return CarritoConverter.entity2PersistenceDTOList(q.getResultList()); }
public CarritoDTO getCarrito(Long id) { return CarritoConverter.entity2PersistenceDTO(entityManager.find(CarritoEntity.class, id)); }
public CarritoDTO createCarrito(CarritoDTO carrito) { CarritoEntity entity = CarritoConverter.persistenceDTO2Entity(carrito); entityManager.persist(entity); return CarritoConverter.entity2PersistenceDTO(entity); }