Using EclipseLink 2.6.0 I'm getting this mapping
CREATE TABLE individualjob_fitvalue
(
individualjob_id bigint,
fitvalue double precision,
fitvalue_key character varying(255),
CONSTRAINT fk_individualjob_fitvalue_individualjob_id FOREIGN KEY (individualjob_id)
REFERENCES individualjob (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
ALTER TABLE individualjob_fitvalue
OWNER TO postgres;
for this field
@ElementCollection
private Map<String, Double> fitValue = new HashMap<String, Double>();
... no primary key.
This legal(?) JPQL throws a NPE
"SELECT o.individual.id FROM IndividualJob AS o JOIN o.fitValue f WHERE o.job.id = :id AND o.job.dtype = :type AND KEY(f) = '/' ORDER BY VALUE(f)"
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.mappings.ForeignReferenceMapping.getOrderByNormalizedExpressions(ForeignReferenceMapping.java:2505)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.normalizeOrderBy(SQLSelectStatement.java:1639)
at org.eclipse.persistence.internal.expressions.SQLSelectStatement.normalize(SQLSelectStatement.java:1428)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildReportQuerySelectStatement(ExpressionQueryMechanism.java:642)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.buildReportQuerySelectStatement(ExpressionQueryMechanism.java:587)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.prepareReportQuerySelectAllRows(ExpressionQueryMechanism.java:1696)
at org.eclipse.persistence.queries.ReportQuery.prepareSelectAllRows(ReportQuery.java:1207)
at org.eclipse.persistence.queries.ReadAllQuery.prepare(ReadAllQuery.java:798)
at org.eclipse.persistence.queries.ReportQuery.prepare(ReportQuery.java:1075)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:666)
... 104 more
expecting a PK on the mapped table.
Bug?