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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:54:44+00:00 2026-05-18T09:54:44+00:00

So i’m working on a project (JSF2, Spring3 Core, MVC, Webflow, MyBatis3, RichFaces, and

  • 0

So i’m working on a project (JSF2, Spring3 Core, MVC, Webflow, MyBatis3, RichFaces, and a legacy Oracle 10g). The source of all of my trouble’s has to do with the design of the database. The problem is that the majority of the DB tables have changing schema (bad design perhaps?). So I need to be able to support the addition & removal of extra columns.

To accommodate this i’ve made MyBatis pull data into a custom “universal” domain object which basically just extends a hashmap. My current issue is updating these hashmap objects. There should be a way to make it work, but I can seem to get MyBatis to co-operate. I’ve tried using HashMap.entrySet() & MyBatis’s , but to no avail. eg.

UPDATE MYTABLE
SET 
<foreach collection="entries" index="i" item="entry" close=""  open="" separator=", ">
  #{entry.key} = #{entry.value}
</foreach>
WHERE FOO='BAR';

I’ve tried a custom TypeHandler but setParameter() doesn’t give me enough access to do what I need. A ResultHandler didn’t give me enough access to each individual result, so I couldn’t use that either.

Now I know i could do something like Obj.createUpdateSqlString() and insert it into the mapper as a literal string, but thats a bit of a hack and leaves me open to SQL injection. Not to mention that would involve escaping a lot of strings, and accounting for a wide range of possible input, and unless all possibilities are covered that opens up the door for some serious bugs.

So is there an established way to do this? Or atleast a halfway decent way? I’ve heard a number of hardcore MyBatis advocates say they’ve yet to encounter a situation MyBatis couldn’t handle gracefully; so MyBatis experts, please help me out!!

  • 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-18T09:54:45+00:00Added an answer on May 18, 2026 at 9:54 am

    It sounds like they were trying to avoid using EAV tables.

    You have to pick your poison when it comes to dynamically adding fields. EAV is good from a theory standpoint but has serious performance issues on large tables. While dynamically adding columns is better for query performance you have to deal with a changing table interface and dynamic sql. I wouldn’t write the database off as a bad design outright.

    You may want to bypass the framework you’re using. Query your table schema (for Oracle look at USER_TAB_COLUMNS) and generate the insert/update scripts. Parameterize them so you are safe from injection. It will be a headache but I don’t see an alternative.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.