persistence@glassfish.java.net

Forum question about DISTINCT query and field mapped to a Blob column

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Fri, 29 Sep 2006 15:00:28 +0200

Hi,

there is a forum post about a JPQL query running into a SqlException:
http://forums.java.net/jive/thread.jspa?threadID=18635&tstart=15

The query fetch joins a collection valued relationship field and the
element class has a field mapped to a blob column. The SELECT clause of
the generated SQL includes the DISTINCT keyword which does not work
because of the blob column. I figured out that for a collection valued
relationships field we always generate a SQL DISTINCT, where for a
single valued relationship we only generate a SQL DISTINCT if the JPQL
includes a DISTINCT.

Would it help to annotate the blob field with fetchType LAZY? Any other
idea?

Regards Michael