Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OrderBy bug on ElementCollection?
OrderBy bug on ElementCollection? [message #1702648] Thu, 23 July 2015 17:39 Go to next message
Mike Summers is currently offline Mike SummersFriend
Messages: 7
Registered: November 2014
Junior Member
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?
Re: OrderBy bug on ElementCollection? [message #1702657 is a reply to message #1702648] Thu, 23 July 2015 19:09 Go to previous messageGo to next message
Mike Summers is currently offline Mike SummersFriend
Messages: 7
Registered: November 2014
Junior Member
Adding a PK on the Map table doesn't seem to help.
Re: OrderBy bug on ElementCollection? [message #1703421 is a reply to message #1702657] Fri, 31 July 2015 12:54 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1380
Registered: July 2009
Senior Member
I'd recommend filing a bug as EclipseLink should not be throwing an NPE. I'm not certain how useful the query would be though, as you are selecting only o.individual.id but ordering on a 1:M relationship. You are going to get duplicate o.individual.id's throughout the resultset. You might try adding the VALUE(f) to the select and see if that helps with the NPE
Previous Topic:EclipseLink Unmarshalling null Strings to ""(Empty Strings)
Next Topic:JAP Batch Writing
Goto Forum:
  


Current Time: Mon Mar 08 01:08:28 GMT 2021

Powered by FUDForum. Page generated in 0.01470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top