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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:58:22+00:00 2026-05-29T08:58:22+00:00

I get this error, when trying to connect two table via manytomany: ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate]

  • 0

I get this error, when trying to connect two table via manytomany:
ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Unsuccessful: alter table PARAM_TRENDVALUE add constraint FK_TrendValue foreign key (AreaID, PcID, DeviceID, ValueID) references usrIFDBMaster.tblTrdProcessValues
08:44:43,800 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] Die ‘usrIFDBMaster.tblTrdProcessValues.DeviceID’-Spalte hat nicht denselben Datentyp wie die verweisende ‘PARAM_TRENDVALUE.PcID’-Spalte im ‘FK_TrendValue’-Fremdschlüssel.

Principaly hibernate is trying to map the wrong columns.

Param.java:

This is the key:

@EmbeddedId
@AttributeOverrides( {
        @AttributeOverride(name = "pcId", column = @Column(name = "PcID", nullable = false)),
        @AttributeOverride(name = "unitId", column = @Column(name = "UnitID", nullable = false)),
        @AttributeOverride(name = "paramId", column = @Column(name = "ParamID", nullable = false)) })
public ParamId getId() {
    return this.id;
}

This is the mapping:

/**
 * @return the connection
 */
@ManyToMany
@ForeignKey(name = "FK_Param")
@JoinTable(
        name="PARAM_TRENDVALUE",
        inverseJoinColumns={    
                @JoinColumn(name = "PcID", referencedColumnName = "PcID"),
                @JoinColumn(name = "AreaID", referencedColumnName = "AreaID"),
                @JoinColumn(name = "DeviceID", referencedColumnName = "DeviceID"),
                @JoinColumn(name = "ValueID", referencedColumnName = "ValueID")
        }
)
public List<TrendValue> getTrendValues() {
    return trendValues; 
}

Trendvalue.java:

This is the key:

@EmbeddedId
@AttributeOverrides( {
        @AttributeOverride(name = "pcId", column = @Column(name = "PcID", nullable = false)),   
        @AttributeOverride(name = "areaId", column = @Column(name = "AreaID", nullable = false)),
        @AttributeOverride(name = "deviceId", column = @Column(name = "DeviceID", nullable = false)),
        @AttributeOverride(name = "valueId", column = @Column(name = "ValueID", nullable = false))
         })
public TrendValueId getId() {
    return this.id;
}

This is the mapping:

/**
 * @return the params
 */
@ManyToMany(
        mappedBy="trendValues",
        targetEntity=Param.class
    )
@ForeignKey(name = "FK_TrendValue")
public List<Param> getParams() {
    return params;
}

It´s the first manytomany I try to use, and it should work, I already tried without inversejoincolumns, with joincolumns, defining exactly the tables and datatypes in “joincolumns/inversejoincolumns”, …
Don’t know what else could be the problem.

  • 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-29T08:58:23+00:00Added an answer on May 29, 2026 at 8:58 am

    This is not the way it should work, but it worked: I added the connection table manually, both the foreign keys too, but, as shown in the picture I had too keep this exact order of the keys! Thats not the order as it is shown in the main table TrendValues, but it seems to be some random order…enter image description here

    If somebody knows, why this order has to be this way, and how I can change hibernate annotations, so that it takes this same order, I’d be very grateful.

    Also, I can now start the program, with the my annotations but the tables aren’t changed anymore.

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

Sidebar

Related Questions

i get this following error when i am trying to connect my localhost mysql
I get this error when trying to connect to SQL Server. Error is: Login
I get this error when trying to make the executable, the code compiles correctly
I get this error when trying ruby script/console Rails requires RubyGems >= . Please
I get this error when trying to link a win32 exe project. I have
I get this error when trying to load a Zend Framework application: Fatal error:
i get this error when trying this: ERROR method name expected. How should i
I always get this error when trying to compile my file with Boost::GIL PNG
why would I get this error when trying to do a local install of
I am trying to figure out why I get this error. My code is

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.