Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 296791

Summary: Ignore case on field comparisons for PostgreSQLPlatform
Product: z_Archived Reporter: Rodrigo Hjort <rodrigo.hjort>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: christopher.delahunt, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Rodrigo Hjort CLA 2009-12-03 06:45:48 EST
When using native queries with PostgreSQL, we need to invoke the following command in order to prevent the error shown in the stack trace.

PostgreSQLPlatform.setShouldIgnoreCaseOnFieldComparisons(true);

Is it possible to initially set "shouldIgnoreCaseOnFieldComparisons" to true in PostgreSQLPlatform class, according to this DBMS behavior?

PS: JPA 1.0's EntityManager.createNativeQuery(String, Class) is being called.


Failing stack trace:

[EL Fine]: 2009-12-02 17:58:53.063--ServerSession(9296972)--Connection(20870565)--Thread(Thread[main,5,main])--select * from auctions where status = ? order by creation desc limit ?
	bind => [0, 20]
[EL Warning]: 2009-12-02 17:58:53.079--UnitOfWork(7437713)--Thread(Thread[main,5,main])--Exception [EclipseLink-6044] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.QueryException
Exception Description: The primary key read from the row [DatabaseRecord(
	 => 27
	 => 7.7
	 => 2009-11-06 17:04:36.528
	 => null
	 => 0
	 => 2009-11-27 06:50:48.837
	 => 3912.2
	 => 0
	 => 21
	 => 905)] during the execution of the query was detected to be null.  Primary keys must not contain null.
Query: ReadAllQuery(name="newestAuctions" referenceClass=Auction sql="select * from auctions where status = ? order by creation desc limit ?")
Comment 1 Rodrigo Hjort CLA 2009-12-03 06:56:20 EST
Actually it is JPA 1.0's EntityManager.createNamedQuery(String) method along with the annotation below:

@NamedNativeQuery(
    name = "newestAuctions",
    query = "select * from auctions where status = ?1 order by creation desc limit ?2",
    resultClass = Auction.class
)
Comment 2 Tom Ware CLA 2009-12-07 09:54:52 EST
Setting target and priority.  For information about the meanings of these fields see:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 3 Chris Delahunt CLA 2012-11-21 12:29:52 EST
Fix 299926 in 2.1 added a "eclipselink.jpa.uppercase-column-names" property to enable case sensitivity without having to call platform code, but the default was still false.  

The this was changed to true as of EclipseLink 2.5 with the fix for 321649, so marking this as a duplicate.

*** This bug has been marked as a duplicate of bug 321649 ***
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:32:55 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink