java - How to return a set of persisted objects? -


I have a method to create client objects through unit managers. I want to add another method that is made of objects A set will return; How can I do this in my case? For example, I have the following code:

  public class DefaultCoreRepository implemented CoreRepository {Private EntityManager entityManager; @ Peristenas CONTACT (entity name = "CRM-DB") Public Zero Set Entity Manager (Entity Manager Unit Manager) {this.entityManager = entityManager; } Private & lt; T & gt; T existence (ti entity) {entityManager.persist (unit); Return unit; } Public Zero making customer (customer customer) {continuous (customer); } Public set & lt; Customers & gt; GetCustomers () {// code can be written here}    

You write a query Change the list in such a way and to set:

  public set & lt; Customers & gt; GetCustomers () {new hashset and lieutenant; Customers & gt; (CreateQuery ("Customer Select c from c," Customer.class) .getResultList ()); }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -