Always getting distinct results in fetch?

Hugi Thordarson <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi all,
let's say I'm performing a simple single column fetch. Example:

--------------------------------------------------
List<Object[]> customers = ObjectSelect
	.query( Customer.class )
	.columns( Customer.CPRNR )
	.select( oc );

System.out.println( "Customers: " + customers.size() );
--------------------------------------------------

This generates the following output:

--------------------------------------------------
- --- transaction started.
- SELECT "t0"."cprnr" FROM "nb_customer" "t0" 
- === returned 462653 rows. - took 210 ms.
- +++ transaction committed.
Customers: 169770
--------------------------------------------------

As you can see, the fetch returns 462.653 rows which is the number of customers in the DB, and the number I expected.
However, the resulting list only contains 169.770 objects—the number of distinct values of CPRNR.

Why? It's not a distinct fetch. I'm feeling particularly stupid today, and I'm definitely missing something here, I just don't understand what :).

Cheers,
- hugi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.