Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6821645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:34:09+00:00 2026-05-26T21:34:09+00:00

To get more familiar with the new Java EE 6 System I have created

  • 0

To get more familiar with the new Java EE 6 System I have created a little demo application that should be able to store some user input in a postgres database.

I am using:
– glassfish 3.1
– Postgres 9.1
– OpenJPA 2.1.1

For this purpose I wrote following entity:

@Entity
public class User implements Serializable
{

@Id
@GeneratedValue(generator="user_seq",strategy=GenerationType.SEQUENCE) 
@SequenceGenerator(name="user_seq", sequenceName="user_seq",allocationSize=1) 
public Long id;

The database is completely empty and the connection pool is configured in glassfish. My persistence.xml looks like this:

 <persistence-unit name="myDatabase" transaction-type="JTA" >
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>jdbc/myDatabase</jta-data-source>
      <properties>
          <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
          <property name="openjpa.jdbc.DBDictionary" value="postgres" />
        </properties>
</persistence-unit>

Due to the fact, that I dont want to insert all db-objects myself, I activated the automatic schema creation in my jpa properties. With the first start openjpa (or maybe postgre) creates a new sequence named ‘user_seq’ as mentioned in the annotations of the entity.
This works fine. But then openjpa wants to create the table ‘user’ and throws following exception:

Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: 
FEHLER: Syntaxfehler bei »User«
    Position: 14 {stmnt 31631786 CREATE TABLE User 
        (id BIGINT NOT NULL, userlastlogin VARCHAR(255), username VARCHAR(255),
         userpassword VARCHAR(255), PRIMARY KEY (id))} [code=0, state=42601]

The SQL-Statement seems to be fine. If I create the table ‘user’ myself, I get the ReportingSQLException that openjpa is not able to insert the entity in the existing table.

First I thought that openjpa and postgre both wants to create the sequence with activated schema-creation. So changed the property to:

<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(Sequences=false)" />

Unfortunately this did not work either.

What else can I say.. Hm.. My DAO looks like this:

@Stateless
public class DAOService
{
@PersistenceContext
protected EntityManager em;

public <T> T create(T t)
{
    this.em.persist(t);
    this.em.flush();
    this.em.refresh(t);
    return t;
}

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:34:10+00:00Added an answer on May 26, 2026 at 9:34 pm

    Perhaps ‘User’ is a reserved keyword on postgres? Can you try specifying the name of your Entity to be User0 or something?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To get myself a little more familiar with content providers in Android, I'm making
I'm trying to get more familiar with AJAX, and web services, so I have
I'm writing a mini-shell to get more familiar with Unix process management in C.
I have been trying to get more in to TDD. Currently keeping it simple
I've got a question regarding git branching protocol. I'm starting to get more familiar
I am a little ashamed to say that I have never used an ORM;
First off I should forewarn you that I am a new grad(and EE at
I am trying to get familiar with the new ruby selenium-webdriver as it appears
I'm trying to get more familiar with HTML5. I am an experienced programmer, but
I'm new to linq and making myself use it more and more to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.