Re: Problem using to-many relationship on where clause

2017-11-28 Thread Juan Manuel Diaz Lara
I created a new project, with entities Products -toMany-> StockcurrentCorporativo, with same results. Tracing code, I arrived to DefaultSelectTranslator#isUnsupportedForDistinct, this is the cause for cayenne not including a DISTINCT in generated SQL, because I have columns mapping to types "not

Re: Problem using to-many relationship on where clause

2017-11-28 Thread Juan Manuel Diaz Lara
I am agree that this kind of query should generate a SQL DISTINCT, but the fact is that adding a joint()brings only one product on result even the sql generates 16 rows, so Cayenne is doing some kind of IN-MEMORY DISTINCT that is not done without a joint(), maybe a bug because there are two diff

Re: Problem using to-many relationship on where clause

2017-11-28 Thread Lon Varscsak
I think the part that's missing is a "distinct". I'm assuming there are 4 stockcurrent_corporativo rows for that one product, but if it had a distinct it would be showing one. I don't think that ObjectSelect/FluentSelect have the ability to turn on/off distinct, but for me, this always generates