Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Database creation not working in eclipselink with glassfish 4 and postgress(duplicate of http://stackoverflow.com/questions/31319038/database-creation-not-working-in-eclipselink-with-glassfish-4-and-postgress)
Database creation not working in eclipselink with glassfish 4 and postgress [message #1701140] Thu, 09 July 2015 13:56 Go to next message
Bram Bourgoignie is currently offline Bram BourgoignieFriend
Messages: 2
Registered: July 2015
Junior Member

Helo all,

I want to create the database based on Entities. Configuration:


  • Glassfish: GlassFish Server Open Source Edition 4.1 (build 13)
  • Eclipselink: Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd (delivered with glassfish)
  • Database: PostgreSQL Version: 9.4.2
  • Driver: PostgreSQL Native Driver Version: PostgreSQL 9.4 JDBC4.1 (build 1201)


From the moment eclipselink starts creating the database I see the following statements in the logs after putting a lot of log parameters on finest:


  • SELECT ID FROM table_name WHERE ID <> ID
  • SELECT 1


This is repeated 4-5 times. The first query gives the following obvious postgres error:

org.postgresql.util.PSQLException: ERROR: relation "table_name" does not exist Position: 16

As a result a following queries give the following error:

org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block

After this eclipselink continues creating the tables:

CREATE TABLE table_name (ID BIGINT NOT NULL, PRIMARY KEY (ID))

But produces the same error.

For some reason creating the database happens in a transaction. I found the source code responsible, but I can't find out how the transaction is started. I can give more detailed information, but maybe somebody can already help now.

Best regards.
Re: Database creation not working in eclipselink with glassfish 4 and postgress [message #1701151 is a reply to message #1701140] Thu, 09 July 2015 14:27 Go to previous messageGo to next message
Petros Splinakis is currently offline Petros SplinakisFriend
Messages: 12
Registered: September 2014
Junior Member
Have you tried setting the eclipselink.target-database property to PostgreSQL or org.eclipse.persistence.platform.database.PostgreSQLPlatform?

Please also share your persistence.xml file if the above does not resolve the issue.
Re: Database creation not working in eclipselink with glassfish 4 and postgress [message #1701167 is a reply to message #1701151] Thu, 09 July 2015 15:23 Go to previous message
Bram Bourgoignie is currently offline Bram BourgoignieFriend
Messages: 2
Registered: July 2015
Junior Member
By setting this I get the same error message, but in a slightly different form.

This is the persistence.xml:

The http are connected in my file. I just can't post links...

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="h ttp://java.sun.com/xml/ns/persistence" xmlns:xsi="h ttp://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="h ttp://java.sun.com/xml/ns/persistence h ttp://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="AntennasOperatingSystemServerPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <non-jta-data-source>MyDatabase</non-jta-data-source>
    <class>... bunch of classes ... </class>
     <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
      <property name="eclipselink.logging.level" value="ALL"/>
      <property name="eclipselink.logging.logger" value="org.eclipse.persistence.logging.DefaultSessionLog"/>
      <property name="eclipselink.deploy-on-startup" value="true"/>
      <property name="eclipselink.ddl-generation.output-mode" value="database"/>
      <property name="eclipselink.logging.level.sql" value="FINEST"/>
      <property name="eclipselink.ddl-generation" value="create-tables"/>
      <property name="eclipselink.target-database" value="PostgreSQL" />
    </properties>
  </persistence-unit>
</persistence>

[Updated on: Thu, 09 July 2015 15:24]

Report message to a moderator

Previous Topic:Named parameters in Native SQL
Next Topic:EclipseLink and Nullable Parts composite key
Goto Forum:
  


Current Time: Tue Mar 09 12:10:08 GMT 2021

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

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

Back to the top