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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:27:03+00:00 2026-05-18T04:27:03+00:00

I would like to add a user defined column which will auto increment on

  • 0

I would like to add a user defined column which will auto increment on new record insertion, how should I do this? so that it runs on h2, mysql

@Entity public class Parent {

@OneToMany List<Child> children;

}

@Entity public class Child {
    int sortOrder;
}

e.g. Parent1 has Child{1, 2, 3}
Parent2 has {1, 2}

Note: Values within each Parent needs to be auto incremented not outside.

  • 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-18T04:27:04+00:00Added an answer on May 18, 2026 at 4:27 am

    Set the Id type as identity, and the DB tbale should handle the Identity insertion.

    sample,

    <id
                name="dayTypeId"
                column="Day_Type_ID"
                type="int">
    
                <generator class="identity">
                </generator>
            </id>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

net website, I would like to add button by which user can view the
I'd like to allow a user to add a shape (which would just be
I have made some user-defined exceptions and I would like to add an error
I would like to add some custom data to an image the user generates
I am using Authlogic for my user authentication, and would like yo add roles
I would like the user to add several pins to a map to represent
I have own project and i would like add for this class same as
I would like to add a custom calculation method to a managed object (which
I'd like to add user-defined custom fields to an existing entity in EclipseLink. For
We would like to have user defined formulas in our c++ program. e.g. The

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.