Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Some generated queries fail in PostgreSQL with pgjdbc-ng driver

Assuming I understand the problem, you should be able to deal with this issue using our "shouldBindLiterals" setting in your database platform.

In a SessionCustomizer, you should be able to access the databasePlatform and call setShouldBindLiterals(false).

On 27/08/2013 6:34 AM, Andreas Joseph Krogh wrote:
På tirsdag 27. august 2013 kl. 10:54:04, skrev Bernard <bht237@xxxxxxxxx>:
That's Postgresql, the only database engine I know of that does this.
Asking EL to fix this is probably not a bad idea, because the
Postgresql people behave like gods. The problem is normally in the
engine not the driver.

They have an excuse for why they expect that even null has a type
parameter so you cannot write some standard JPQL queries.

See https://github.com/pgjdbc/pgjdbc/issues/3 for another example.

I would try to use the EL "cast" extension as a workaround. This
solved all my problems.

Otherwise if I was you I wouldn't hesitate to make a lot of noise in
the Postgresql mailing lists - they are so unprofessional they do not
even have a bug tracking system. Really, I am not joking. You can't
find out the status of anything that you report there.
 
Ok. Even if PG cannot support preparing statements for unknown types, this specific issue seems to be easily solved by having EL generate "...WHERE EXISTS (SELECT 1 FROM ...)" instead of "SELECT ? FROM" and setting 1 as value, maby even generate "SELECT * FROM" as the sub-query and have the enginge optimize it the way it wants (I seem to remember someone on the PG-list informing that best practice is to issue EXISTS(SELECT * FROM ..) instead of (SELECT 1 ...)).
 
How do I use the EL cast-extention? I tried with " WHERE EXISTS(SELECT cast(e.id INTEGER) FROM MyEntity e)" but it still generated the "SELECT ? FROM"-query.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top