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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:04:32+00:00 2026-06-09T10:04:32+00:00

I am new to h2.I just using h2 in spring embedded mode with hibernate.I

  • 0

I am new to h2.I just using h2 in spring embedded mode with hibernate.I am trying to execute the following scripts using h2.

CREATE TABLE acct_authority (
  id bigint(20) NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  value varchar(255) NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY name (name)
);

The table acct_authority is created without any error.But if i create another table with the following script.

CREATE TABLE acct_role (
  id bigint(20) NOT NULL auto_increment,
  name varchar(255) NOT NULL default '',
  PRIMARY KEY  (id),
  UNIQUE KEY name (name)
);

It shows error as constraint name allready exists.What mistake i did.

  • 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-09T10:04:33+00:00Added an answer on June 9, 2026 at 10:04 am

    You tried to create two constraints with same name. As you see, both CREATE TABLE statements contain following:

    UNIQUE KEY name (name)
    

    Result is that first one creates constraint named name, and second one fails because constraint name already exists. Problem can be solved by using unique names. Also in general it makes sense have little bit more descriptive names for database objects. Maybe you can use for example something like following:

      UNIQUE KEY acct_authority_name_UNIQUE (name)  
      ...  
      UNIQUE KEY acct_role_name_UNIQUE (name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A new colleague has just suggested using named HQL queries in Hibernate with annotations
I'm currently using Spring and Hibernate. At the moment, if I make a create
I just started using the new Eclipse 4.2 (Juno) Null Analysis. On code like
I just started using the new POI 3.6 http://poi.apache.org XSSF which was released in
So I'm very new to JSF, I just started using it a few days
I'm getting an access violation on a char array I just created using new
I'm pretty new to APEX ( well, just started using it ~an hour ago),
I just created a new project using the visual studio cordova starter template. However
I just started developing my brand new windows 8 application last week using mvvm
I have just created a new project in VS2010 using the Visual c# >

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.