Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/FAQ/JPA/PostgreSQL"

< EclipseLink‎ | FAQ‎ | JPA
 
(5 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
* PostgresSQL meta-data returned as lower case : This means to use native SQL queries you may need to ensure your column names are specified as lower case in your mappings.  You can also use the EclipseLink persistence.xml property <code>"eclipselink.jdbc.uppercase-columns"="true"</code>, to force the meta-data columns to uppercase.  This may also be required if using the EclipseLink <code>IntegrityChecker</code> to check the database table and column names.
 
* PostgresSQL meta-data returned as lower case : This means to use native SQL queries you may need to ensure your column names are specified as lower case in your mappings.  You can also use the EclipseLink persistence.xml property <code>"eclipselink.jdbc.uppercase-columns"="true"</code>, to force the meta-data columns to uppercase.  This may also be required if using the EclipseLink <code>IntegrityChecker</code> to check the database table and column names.
 
* PostgreSQL seems to be more picky on parameter typing when using binding.  This can be an issue when binding <code>null</code> values in some cases.  Ensure you have the correct types set in your mappings such as setting the <code>type</code> of the mapping's <code>DatabaseField</code>.  You can also use dynamic SQL using the persistence.xml property <code>"eclipselink.jdbc.bind-parameters"="false"</code>.
 
* PostgreSQL seems to be more picky on parameter typing when using binding.  This can be an issue when binding <code>null</code> values in some cases.  Ensure you have the correct types set in your mappings such as setting the <code>type</code> of the mapping's <code>DatabaseField</code>.  You can also use dynamic SQL using the persistence.xml property <code>"eclipselink.jdbc.bind-parameters"="false"</code>.
* Postgres seems to abort the transaction if an error occurs, so accessing the database after a failure may not be possible until after calling <code>rollback</code>.
+
* PostgreSQL seems to abort the transaction if an error occurs, so accessing the database after a failure may not be possible until after calling <code>rollback</code>.
* Postgres does not seem to current allow setting a query timeout.
+
* PostgreSQL does not seem to allow setting a query timeout.
 +
* PostgreSQL supports pessimistic locking, including the NO_WAIT option.
 +
* PostgreSQL supports <code>SEQUENCE</code> objects and <code>IDENTITY</code> auto assignment for generating ids.
 +
* PostgreSQL supports stored procedures.
 +
* PostgreSQL supports <code>maxResult</code> and <code>firstResult</code> pagination.
 +
* PostgreSQL supports structure data-types, JDBC Struct and Array types.  These can be mapped using EclipseLink's @Struct and @Array annotations.
 +
* PostgreSQL supports spatial data-types.  These may require custom conversion to use in JPA.  Refer to the @StructConverter.
 +
 
 +
[[Category:EclipseLink FAQ|PostgreSQL]]
 +
[[Category:EclipseLink|PostgreSQL]]

Latest revision as of 10:26, 19 May 2011

PostgreSQL is an open source databases using the BSD license. PostgreSQL originally evolved from the Ingres.

Most JPA and EclipseLink functionality should work with PostgreSQL.

Some common PostgresSQL issue are:

  • PostgresSQL meta-data returned as lower case : This means to use native SQL queries you may need to ensure your column names are specified as lower case in your mappings. You can also use the EclipseLink persistence.xml property "eclipselink.jdbc.uppercase-columns"="true", to force the meta-data columns to uppercase. This may also be required if using the EclipseLink IntegrityChecker to check the database table and column names.
  • PostgreSQL seems to be more picky on parameter typing when using binding. This can be an issue when binding null values in some cases. Ensure you have the correct types set in your mappings such as setting the type of the mapping's DatabaseField. You can also use dynamic SQL using the persistence.xml property "eclipselink.jdbc.bind-parameters"="false".
  • PostgreSQL seems to abort the transaction if an error occurs, so accessing the database after a failure may not be possible until after calling rollback.
  • PostgreSQL does not seem to allow setting a query timeout.
  • PostgreSQL supports pessimistic locking, including the NO_WAIT option.
  • PostgreSQL supports SEQUENCE objects and IDENTITY auto assignment for generating ids.
  • PostgreSQL supports stored procedures.
  • PostgreSQL supports maxResult and firstResult pagination.
  • PostgreSQL supports structure data-types, JDBC Struct and Array types. These can be mapped using EclipseLink's @Struct and @Array annotations.
  • PostgreSQL supports spatial data-types. These may require custom conversion to use in JPA. Refer to the @StructConverter.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.