Porównywanie dwóch list [hibernate]

0

Jak porównać dwie listy w hibernate

query = session.createQuery("from User u where elements(organizationalUnits) in (:unitIdss) 
query.setParameterList("unitIdss", unitIdss); 
UserDTO
public class UserDTO implements Identifiable {
....
private List<OrganizationalUnitDTO> units = new ArrayList<OrganizationalUnitDTO>(); 
1

Listy są w javie nie w Hibernate

//

Jeżeli chcesz porównać dwie listy obiektów, czyli np:

List<UserDTO> users1 = ...
List<UserDTO> uisers2 = ...

to sprawa jest prosta

users1.equals(uisers )

a równe będą jeżeli

Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.

0

hmm ale to zadziała przy filtrowaniu danych ? po where ?

0

w tym organizationalUnits siedzi jakaś lista powiedzmy integerów które mają się zawierać w tym parametrze które wpisałeś jako parametr?

1 użytkowników online, w tym zalogowanych: 0, gości: 1