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

The Archive Base Latest Questions

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

I have a class, Location. Location contains a List of BorderPoint objects, but it

  • 0

I have a class, Location. Location contains a List of BorderPoint objects, but it can be a HUGE list (20,000 is not impossible). The tables for this are LOCATION and BORDERPOINT.

I initially populate Location via an import from an ESRI Shapefile. Here’s a code snip:

        try {
            while (featureIterator.hasNext()) {
                Location location = new Location();

                SimpleFeatureImpl feature = (SimpleFeatureImpl) featureIterator.next();

                // set the information in location based on stuff in the feature, lets me clean up this
                // method a bit
                setLocationInfo(location, feature);

                List<BorderPoint> borderPointList = getBorderPoints(feature, location);
                //saveBorderPoints(location, feature);
                location.setBorderPointList(borderPointList);

                try {
                    locationRepository.persist(location);
                } catch (RepositoryException e) {
                    throw new ServiceException("processShapefile() threw RepositoryException", e);
                }
            }
        } finally {
            featureIterator.close();
        }

Since there are so many BorderPoint objects in the List, but I am only saving them by calling persist on the Location object, can I automatically set some sort of batch size for persisting the BorderPoints?

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

    I don’t know OpenJPA, but I have used Hibernate a lot. You probably have to control the transaction size yourself. If you change the code a little this should be easy:

    1. Create and persist the Location. You should probably also commit the database transaction.
    2. Persist BorderPoints into the database, making sure that you have set their parent Location. This implies that the parent Location is mapped on BorderPoint. You probably want to commit every 100 BorderPoints or so.
    3. Query the Location from the database and access its BorderPoints. All persisted BorderPoints should be there.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: class MyObj { int Id; string Name; string Location; }
Hello I have this class that contains a actionPerformed to perform a query it
I have the following class: public class Location { public int Id { get;
I have a Location class which represents a location somewhere in a stream. (The
I am trying to develop an algorithm wherein I have a Location Class. In
I have a Meeting model: class Meeting < ActiveRecord::Base has_one :location, :class_name => MeetingLocation,
I have the code: <div class='selectAnAction'> <ul> <li class='actionSelect'><span>Select an Action</span></li> <li class='action' onclick='location.href=\/post.php?key=.$row['hash'].\;'>post</li>
I have Class and Student objects. Both have collection of another as property. Which
I have an object that contains several fields (ints, Strings, etc) but also a
I have a class that generates the phone location and it updates a TextView

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.