package ch.ivyteam.crm;

import java.util.List;

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.data.persistence.IIvyEntityManager;
import crm.Customer;

public class CustomerRepo
{
  public static Customer persist(Customer newCustomer)
  {
    return entityManager().persist(newCustomer);
  }

  public static List<Customer> getAll()
  {
    return entityManager().findAll(Customer.class);
  }

  private static IIvyEntityManager entityManager()
  {
    return Ivy.persistence().get("erp");
  }

  @SuppressWarnings("unchecked")
  public static List<Customer> findByZip(String zip)
  {
    return (List<Customer>) entityManager().createQuery(
            "SELECT c FROM Customer c WHERE c.zip = :zip ")
            .setParameter("zip", zip)
            .getResultList();
  }

}

@@ -516,41 +516,8 @@
  %7D%0A%0A
-  @SuppressWarnings(%22unchecked%22)%0A
   pu
@@ -583,25 +583,8 @@
 turn
- (List%3CCustomer%3E)
  ent

remove unnecessary cast (#25)