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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:39:42+00:00 2026-05-23T21:39:42+00:00

Given this schema: +—————–+——————+——+—–+——————-+——-+ | Field | Type | Null | Key | Default

  • 0
Given this schema:
+-----------------+------------------+------+-----+-------------------+-------+
| Field           | Type             | Null | Key | Default           | Extra |
+-----------------+------------------+------+-----+-------------------+-------+
| internal_id     | int(10) unsigned | NO   | PRI |                   |       |
| external_id     | varchar(255)     | NO   | PRI |                   |       |
| mapping_type_id | int(4) unsigned  | NO   | PRI |                   |       |
| creation_date   | timestamp        | NO   |     | CURRENT_TIMESTAMP |       |
+-----------------+------------------+------+-----+-------------------+-------+

And this annotation:

@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinTable(name="mapping",
        joinColumns = { @JoinColumn(name="internal_id") },
        inverseJoinColumns = { @JoinColumn(name="external_id") }
)
@WhereJoinTable(clause="mapping_type_id=2")
private List<Video> videos = Lists.newArrayList();

Which works fine with the legacy database, but when I run these annotated classes through hsqldb with a create-drop option (for basic in-memory unit tests), I get the following:

[elided]
Caused by: java.sql.SQLException: Column not found: VIDEOS0_.MAPPING_TYPE_ID in statement 
[elided]

So I checked with SchemaExport, and hibernate is in fact generating the DB Schema with a join table for the mapping, but it is not including the mapping_type_id field. How do I make the schema generate this with the rest of the schema without interfering with code that runs on the existing database?

  • 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-23T21:39:43+00:00Added an answer on May 23, 2026 at 9:39 pm

    The answer to this is to create an embedded ID and use that to map the class through the table, instead of using the join-table syntax. This is easier to fake out if the join table has a row-id, but otherwise, using @Embeddable and @EmbeddedId can make it work.

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

Sidebar

Related Questions

Given this sql schema: create table [dbo].[Courses_Students] ( [DummyColumn] [int] null, [CourseId] [int] not
Given this schema: Fruits - FruitID INT PK - FruitName NVARCHAR(30) - FruitStatusID INT
Given this XML Schema snippet: <xs:element name=data> <xs:complexType> <xs:sequence> <xs:element name=param type=param minOccurs=0 maxOccurs=unbounded
Given a table named person (in a MySQL database/schema), kind of like this one:
Given this db schema (it was handed down to me): (source: robtennyson.us ) I'd
Given this xml schema (fragment): <xs:element name=GetIEnumerableResponse> <xs:complexType> <xs:sequence> <xs:element minOccurs=0 name=GetIEnumerableResult nillable=true xmlns:q4=http://schemas.microsoft.com/2003/10/Serialization/Arrays
In SQLite, given this database schema CREATE TABLE observations ( src TEXT, dest TEXT,
Given an XML layout like this, I'm trying to create a XSD schema to
Given a table with schema like this: id1 id2 day number How can I
I asked this question , and someone suggested this type of schema. I'm not

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.