I would like to fetch a list from a query in Hibernate but without repeated elements.
Currently i have something like:
SELECT t FROM Table t join fetch t.list tl WHERE tl.userid=:userid AND tl.tableid=t.id
This works good! the problem its that it returns the same object as many times as userid its in tl
so lets say userid its found 3 times in tl i am getting:
T
TL1
TL2
TL3
T
TL1
TL2
TL3
T
TL1
TL2
TL3
and i want to get:
T
TL1
T
TL2
T
TL3
or just one:
T
TL1
TL2
TL3
I guess its possible in Hibernate but havent manage it yet.
Thanks in advance