EclipseLink を使用する JPA アプリケーションでは、Circular エンティティが Keyword エンティティと oneToMany 関係を持っています。Circular エンティティには @Lob 型の 2 つの属性があります。この JQL を実行して個別のエンティティを取得すると、次のエラーが発生します。@Lob 属性を持つエンティティで、distinct in を使用するにはどうすればよいですか?
JQLは
SQL is select DISTINCT c from CircularKeyword k join k.circular c where c.retired = false and c.administrativeDivision.id = 1 and k.retired = false and ( upper(c.circularNumber) like '%3%' or upper(c.topic) like '%3%' or upper(k.name) like '%3%' ) order by c.name
エラーは
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Columns of type 'BLOB' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type.
Error Code: -1
Call: SELECT DISTINCT t0.ID, t0.BAIMAGE, t0.CIRCULARDATE, t0.CIRCULARLANGUAGE, t0.CIRCULARNUMBER, t0.CODE, t0.CONTENTS, t0.CREATEDAT, t0.DESCRIPTION, t0.FILENAME, t0.FILETYPE, t0.INTERNAL, t0.KEYWORDS, t0.NAME, t0.ORIGINATINGFILENO, t0.RETIRECOMMENTS, t0.RETIRED, t0.RETIREDAT, t0.TOPIC, t0.ADMINISTRATIVEDIVISION_ID, t0.CATEGORY_ID, t0.CREATER_ID, t0.PERSON_ID, t0.RETIRER_ID, t0.SIGNINGAUTHORITY_ID FROM CIRCULAR t0, CIRCULARKEYWORD t1 WHERE (((((t0.RETIRED = ?) AND (t0.ADMINISTRATIVEDIVISION_ID = ?)) AND (t1.RETIRED = ?)) AND ((UCASE(t0.CIRCULARNUMBER) LIKE ? OR UCASE(t0.TOPIC) LIKE ?) OR UCASE(t1.NAME) LIKE ?)) AND (t0.ID = t1.CIRCULAR_ID)) ORDER BY t0.NAME ASC
bind => [6 parameters bound]
Query: ReportQuery(referenceClass=CircularKeyword sql="SELECT DISTINCT t0.ID, t0.BAIMAGE, t0.CIRCULARDATE, t0.CIRCULARLANGUAGE, t0.CIRCULARNUMBER, t0.CODE, t0.CONTENTS, t0.CREATEDAT, t0.DESCRIPTION, t0.FILENAME, t0.FILETYPE, t0.INTERNAL, t0.KEYWORDS, t0.NAME, t0.ORIGINATINGFILENO, t0.RETIRECOMMENTS, t0.RETIRED, t0.RETIREDAT, t0.TOPIC, t0.ADMINISTRATIVEDIVISION_ID, t0.CATEGORY_ID, t0.CREATER_ID, t0.PERSON_ID, t0.RETIRER_ID, t0.SIGNINGAUTHORITY_ID FROM CIRCULAR t0, CIRCULARKEYWORD t1 WHERE (((((t0.RETIRED = ?) AND (t0.ADMINISTRATIVEDIVISION_ID = ?)) AND (t1.RETIRED = ?)) AND ((UCASE(t0.CIRCULARNUMBER) LIKE ? OR UCASE(t0.TOPIC) LIKE ?) OR UCASE(t1.NAME) LIKE ?)) AND (t0.ID = t1.CIRCULAR_ID)) ORDER BY t0.NAME ASC")