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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:15:40+00:00 2026-05-26T16:15:40+00:00

Hibernate throws an exception when creating the tables, because embedded attributes are mapped to

  • 0

Hibernate throws an exception when creating the tables, because embedded attributes are mapped to the same column.

The class Distance is embedded twice in a class route as followed:

@Embeddable
public class Distance implements Serializable{
    private static final long serialVersionUID = -8466495790824502626L;
    @Column(nullable = false)
    protected Integer distInSec;

    public Distance() {
        super();
    }
}


@Entity
public class Route{
    @Column(nullable=false)
    protected Distance currentDetour;

    @Column(nullable=false)
    protected Distance currentDist;       
}

When hibernate creates the table, it tries to map distInSec of currentDetour as well as of currentDist to the same column “distInSec” in the table route. Hence, the error org.hibernate.MappingException: Repeated column in mapping for entity: is thrown.

If possible I would like to change the configuration in the way that it always produces colums with the names currentDetour_distInSec and currentDist_distInSec. Does anybody have an idea how to do so?

Thanks in advance

  • 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-26T16:15:40+00:00Added an answer on May 26, 2026 at 4:15 pm

    using DefaultComponentSafeNamingStrategy as the naming strategy solved the issue

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

Sidebar

Related Questions

Hibernate throws this exception during SessionFactory creation: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags This
At runtime an application (based on Java/Spring/Hibernate) throws the following exception: 07:18:38.511 ERROR Error
Using hibernate, how can I persist a class with a List<String> field? Consider the
Possible Duplicate: Spring + Hibernate : a different object with the same identifier value
public void uploadFile(ActionEvent evt)throws Exception{ InputFile inputFile=(InputFile)evt.getSource(); byteArrayOutputStream=new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream=new ObjectOutputStream(byteArrayOutputStream); objectOutputStream.writeObject(inputFile.getFile()); reportTemplate.setTemplatePath(inputFile.getFilename());
Possible Duplicate: Hibernate: different object with the same identifier value was already associated with
I'm getting exception while creating connection with SQL Server. ISession factory is shown below
while learning a bit about hibernate i came across famous lazy initialization exception under
My dao class com.myapp.dao.hibernate.XyzDaoImpl is annotated with @Repository @Repository public class UserDaoImpl extends GenericDaoJpa
Why does the UniqueConstraint annotation in the following Hibernate mapping declaration cause the exception

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.