Re: Issue with distinct 3.1

2013-11-12 Thread Andrus Adamchik
Cayenne forces DISTINCT in the generated SQL whether you specify it or not because it detects a match on to-many relationship and realizes that it needs to get rid of duplicates in the cartesian product. So I guess explicit DISTINCT shouldn’t normally be needed. As to why NULL is bound in the D

Re: Issue with distinct 3.1

2013-11-12 Thread Aristedes Maniatis
On 13/11/2013 3:59am, Ramiro Aparicio wrote: > I am really not sure if current behaviour without distinct is ok, but at > least it works for me. Cayenne returns a collection of objects that will never have duplicates. In fact you can choose whether the results return as a Set, List or Map. Ari

Issue with distinct 3.1

2013-11-12 Thread Ramiro Aparicio
I found some strange behaviour trying to use Distinct for the first time. I have the following mapping User is related with User via a mapping table named Contact, the PK is an id as the User can contact the same target several times. I wanted to get all distinct Users contacted by A, so as I w

Re: Help with FK

2013-11-12 Thread Andrus Adamchik
Hi Andres, First you will need to map a relationship based on your FK/PK pair (both DbRelationship and ObjRelationship) [1]. Once you have that in the model and regenerate your java classes, your Ordencompra object will have a method like ‘getCotizacions’, returning a collection of related obje