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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:10:25+00:00 2026-05-26T05:10:25+00:00

In the initial ‘version’ of the application that I’m working on, a design consideration

  • 0

In the initial ‘version’ of the application that I’m working on, a design consideration wasn’t taken into account – no one thought of it.

However, it seems that the original one-to-many relation needs to be refactored into a many-to-many. My question is how best to do this? I’m using MySQL for persistence.

Populating the relationship table will only be a one time effort, I’d rather go with a simple query or a stored procedure approach (I’m not well versed with the latter); rather than write java/jdbc based logic to do it (I know I can and it’s not too difficult, but that’s not what I want)

So here’s an example of the relation:

|VirtualWhiteBoard| -1------*- |Post|

A virtual white board can have many posts. The new functionality is: 1 post should belong to multiple white boards if the user chooses to ‘duplicate’ current white board (not thought of before)

The schema looks like this:

VirtualWhiteBoard (wallName, projectName,dateOfCreation,..., Primary_Key(wallName, projectName));
Post(post_id, wallName,postData,..., Primary_Key(post_id), Foreign_Key(wallName, projectName));

The virtual white board has a composite primary key (wallName, projectName) and each post has a post_id as primary key

Question: Take the primary keys from VirtualWhiteBoard and Post and add it to the new relation ‘has_posts’:

|VirtualWhiteBoard| -1------*- |has_Post| -*------1- |Post|

To keep the previous relationships intact and then drop the foreign key column of wallName in Post.

How best to achieve this? Would a query suffice or stored procedures would be required?

(Although I can do this in the ‘application’ I’d prefer to do it this way, since such refactorings are bound to arise and I don’t want unnecessary java-code lying around that’ll need to be maintained and would personally prefer to have such a skill too 🙂

  • 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-26T05:10:25+00:00Added an answer on May 26, 2026 at 5:10 am

    Create your has_Post table with two columns post_id and wallName and populate it with this query:

    INSERT INTO has_Post(post_id, wallName) SELECT post_id, wallName FROM Post
    

    Then delete the wallName column from Post table.

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

Sidebar

Related Questions

The initial situation is that I map my domain model into a presentation model.
Initial description: My application handles some events and do some task related to that
Trying to get some initial bearings on useful processes that a basic working knowledge
Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my
We're in the initial stages of a large project, and have decided that some
Initial situation: I am working with a proprietary framework ( ESRI 's ArcGIS Engine
Update following initial comments The model has an object in it called 'Account', of
By default the initial PHP session ID is:PHPSESSID However, when I change that to:YourVisit
If I have both the initial key and the hash that was created, is
I need to add initial values to SQLite database, once application is started first

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.