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

  • Home
  • SEARCH
  • 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 676543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:56:23+00:00 2026-05-14T00:56:23+00:00

I have a Map, that I want to persist. The domain object is something

  • 0

I have a Map, that I want to persist. The domain object is something like this:

public class Settings {
    private String key;
    private String value;

    public String getKey() { ... }
    public String getValue() { ... }
    public void setKey(String key) { ... }
    public void setValue(String value) { ... }
}

The standard approach is to generate a Setting for each pair, and saveOrUpdate() it. But it generates way too much queries, because I need to save lots of settings at a time, and it really affects perfomance. Is there a way to do this using one update query?

UPD: Okay, maybe there is a hql syntax for updating multiple rows? Something like

update Settings s1 set s1.value = :value1 where s1.key = :key1
                s2 set s2.value = :value2 where s2.key = :key2
  • 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-14T00:56:24+00:00Added an answer on May 14, 2026 at 12:56 am

    If each setting is a row in a table then there needs to be as many update statements issued. But a few things to look at would be

    1) Tweaking hibernate batch size to say 20 or so which means although hibernate issues 20 updates they are all sent as a batch (with hopefully one network round trip providing drivers permit batching)

    2) Modifying your dao code/transaction logic to do things in batch

    3) Having a stored procedure and passing array values (hibernate and storedprocs are not good friends I think)

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

Sidebar

Related Questions

I have a high-resolution image that I want to use as a tiled map
I have a map that is cut up into a number of regions by
I have an app that I want to have a button that will show
I have a one-many relation: Object ReportCategory: Table("RCA_REPORT_CATEGORY"); Id(r => r.Id, "RCA_ID"); Map(r =>
Here is a snippet of my JavaScript Code that I want to DRY up:
I'm working on a vector map editor and I have a set of elements,
Lets assume i have a function that takes 32bit integer in, and returns random
I have bean MyBean, which has property HashMap - map which values type is
Greetings, I have a jqueryui autocomplete input that uses an ajax call to populate
I want to find the path between two locations on Google Maps which I

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.