コード例 #1
0
 public CartItemDTO createCartItemByClient(CartItemDTO dto, Long idClient) {
   CartItemEntity entity = CartItemConverter.fullDTO2Entity(dto);
   ClientEntity clientEntity = em.find(ClientEntity.class, idClient);
   entity.setClient(clientEntity);
   em.persist(entity);
   return CartItemConverter.fullEntity2DTO(entity);
 }
コード例 #2
0
 public CartItemDTO getCartItemsByClientById(Long idCart, Long idClient) {
   Query q =
       em.createQuery(
           "select u from "
               + entityClass.getSimpleName()
               + " u where u.client.id = :idC and u.id= :id");
   return CartItemConverter.fullEntity2DTO(
       (CartItemEntity)
           q.setParameter("idC", idClient).setParameter("id", idCart).getSingleResult());
 }