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

  • Home
  • SEARCH
  • 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 3666188
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:51:00+00:00 2026-05-19T01:51:00+00:00

I am using Postgres as database and JPA 2.0 as provider. I had been

  • 0

I am using Postgres as database and JPA 2.0 as provider.

I had been using @GeneratedValue(strategy = GenerationType.IDENTITY) which generates its own sequence for that column and also executes this query ( or similar )

ALTER TABLE "comment" ALTER COLUMN id SET DEFAULT nextval('comment_id_seq'::regclass);

Now I am using

@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GEN_COMMENT")
@SequenceGenerator(name = "GEN_COMMENT", sequenceName = "SEQ_COMMENT")

which also generates it’s own sequence but doesn’t execute that query.

My point is that when I had been using IDENTITY then database could automatically insert the column value from sequence which is helpful when there are other accesses into database except via application.

So my question is if there is any way how to force JPA to set default value of that column to sequence without redefinition of @Column(columnDefinition="...")?

Thanks a lot.

  • 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-19T01:51:01+00:00Added an answer on May 19, 2026 at 1:51 am

    This is database specific, the Postgres has defined type serial as generation type IDENTITY which automatically creates this database structure.

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

Sidebar

Related Questions

With doctrine syntax using postgres as database, is it possible to generate a query
I'm using a hand built (Postgres) database with Django. With inspectdb I was able
Is it possible to have the postgres database dump(pg_dump) using SQLAlchemy? i can get
I have a column with the type of Varchar in my Postgres database which
We are currently deploying some applications on a glassfish 3.0.1 using a postgres database
I'm trying to do an insert or update in a postgres database using node.js
im using Postgres 9.0 to save images into the database using 'lo_import' and to
I am using a hibernate application to store data in Postgres database I have
I have a table in Postgres database logs which holds the error logs with
I am building an app which uses a mysql and a postgres database. I'm

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.