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 8334377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:19:46+00:00 2026-06-09T03:19:46+00:00

I use play! framework 2.0 and postgresql. in my db there is users table

  • 0

I use play! framework 2.0 and postgresql.
in my db there is users table and every user ofcourse has a unique id.
so I defined it as serial.

my question is: how to represent a field which it’s data type is serial
in my java project.

p.s. I understood play! framework uses Hibernate annotation

  • 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-06-09T03:19:48+00:00Added an answer on June 9, 2026 at 3:19 am

    From the PostgreSQL documentation, the SERIAL type is equivalent to an ìnteger` with a sequence, so:

    CREATE TABLE tablename (
        colname SERIAL
    );
    

    is equivalent to specifying:

    CREATE SEQUENCE tablename_colname_seq;
    CREATE TABLE tablename (
        colname integer DEFAULT nextval('tablename_colname_seq') NOT NULL
    );
    

    The @Id JPA annotation on the Long type will provide a sequence (equivalent to AUTO_INCREMENT in MySQL).

    So, in you class, just use:

    @Id
    public Long id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found an old question How to use the Play framework to develop a
I can’t use play! framework from a MSYS shell (as used in Git on
I recently stumbled upon Play framework while evaluating frameworks to use in a project.
I'm trying to use Uploadify , an Ajax file uploader, with Play Framework .
i have a simple question. if i use play.db.ebean.Model to have my Model extend
I use AVAudioPlayer to play an mp3 file to a user within my iPhone
I am brand new to the Play framework, but I am trying to use
I want to use existing database. Entity table has a column named code to
Am trying to use MSSQL server with Play Framework, In my application.conf db.url=jdbc:microsoft:sqlserver://localhost\SQL2008:1433;DatabaseName=testDB db.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
Just a quick question on the memory usage of the play framework. I have

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.