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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:07:21+00:00 2026-05-24T18:07:21+00:00

I am trying to create an entity for the table structure given belos (id,

  • 0

I am trying to create an entity for the table structure given belos

(id, name, task, leader_id)

this table gives the information about the team users for the particular task and their leader for the team.

I wrote the entity like this

@Column(name = "id", insertable = false, nullable = false, updatable = true)
private Integer id;

@Col umn(name = "name", nullable = false)
private String tokenName;

@Column(name = "task", nullable = false)
private String task;

@ManyToOne(cascade = ALL, fetch = LAZY)
@JoinColumn(name = "leader_id")
private User leader;

I created the ddl through hibernate3:hbm2ddl and it looks like this

alter table user
drop
foreign key FK60FD5D6395C4EEC2;

drop table if exists user;

create table user (
    id integer not null auto_increment,
    task varchar(255),
    name varchar(255) not null,
    leader_id integer,
    primary key (id)
);

alter table user
    add index FK60FD5D6395C4EEC2 (leader_id),
    add constraint FK60FD5D6395C4EEC2
    foreign key (leader_id)
    references user (id);

while exporting this schema through maven-sql-plugin, I am getting the following error

[ERROR] Failed to execute:
alter table user
drop
foreign key FK60FD5D6395C4EEC2
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Column "FOREIGN" not found; SQL statement:

alter table user
drop
foreign key FK60FD5D6395C4EEC2 [42122-158]

Where I am doing wrong?

  • 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-24T18:07:23+00:00Added an answer on May 24, 2026 at 6:07 pm

    Try this:

    @ManyToOne(cascade = ALL, fetch = LAZY)
    @JoinColumn(name = "leader_id")
    @NotFound(action = NotFoundAction.IGNORE) 
    public User getLeader()
    {
      return leader;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to realise this table structure: http://www.img-teufel.de/uploads/Unbenannt1d4f8a349jpg.jpg (not embedded due to size) It
I am trying to create a generic table editor using Entity Framework. I would
I am trying to create 'Table per entity hierarchy' I want to set the
I am having a trouble while trying to create an entity with a custom
I am trying to create a new contact using Dynamic Entity. The sample i
I'm trying to use a view to create an ADO.NET entity using a view.
I'm trying to create a db structure in which I have many types of
I am trying to create an Entity Framework 4 model based on a legacy
I'm trying to create a UniqueAttribute using the System.ComponentModel.DataAnnotations.ValidationAttribute I want this to be
I'm trying to create Class Table Inheritance as in ( http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html ) So let's

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.