java - JPA NOT IN statement -
I have an app that uses MySQL, JPA with Eclipse links.
I have marked DB user's collection as "active" and already have already been loaded in the list.
This is my method:
public list & lt; Users & gt; Search AllButUsers (list & lt; user & gt; users) {list & lt; Users & gt; List = null; Query query = em.createQuery ("Choose from user and user not in: User and U.State =: Status"); Query.setParameter ("Status", "Active"); Query.setParameter ("user", user); List = query.getResultList (); Return list; }
and logs me to the server:
OK: selector, time, email, name, password, salt, status from user where (( Not a claimant (?)) And (position =?)) Bind => [Com.wa.gp.jpa.entities.User [iduser = 2], ACTIVE]
binding => [ user from com.wa.gp.jpa . [IDUser = 2] , Active] shows me that instead of binding the ID, it passes the value to the user.tasting method, thus in such a way that the user passes I thought it would work only by sending an object to JPA and it would fool you by itself.
I do not know that this is a required behavior, I think it is. How can I query this without having to change heroism in the user? Do I need to pass a list of IDs instead of giving users a list? If this is the case then I was simply told.
Thanks
Comments
Post a Comment