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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:02:43+00:00 2026-05-14T09:02:43+00:00

I have some code like this : PersistenceManager pm=PMF.get().getPersistenceManager(); String query=select from +PayPal_Message.class.getName()+ where

  • 0

I have some code like this :

        PersistenceManager pm=PMF.get().getPersistenceManager();
        String query="select from "+PayPal_Message.class.getName()+" where processed == false order by time desc";
        List<PayPal_Message> messages=(List<PayPal_Message>)pm.newQuery(query).execute();
        if (messages.isEmpty())
        {
        }
        else
        {
          for (PayPal_Message g : messages)
          {
            Contact_Info_Entry A_Contact_Entry=Process_PayPal_Message_To_Get_A_License(g.getContent().getValue());
            pm=PMF.get().getPersistenceManager();
            try
            {
              pm.makePersistent(A_Contact_Entry);
              g.setProcessed(true);
              pm.makePersistent(g);
            }
            catch (Exception e)
            {
              Send_Email(Email_From,"nm67@yahoo.com","Servlet Error Message [ "+time+" ]",new Text(e.toString()));
            }
//            finally { pm.close(); }

          }
        }
        pm.close();

I wonder if it’s ok to use the pm above to process multiple objects before closing it. Or do I have to get and close pm for processing each object ?

  • 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-14T09:02:44+00:00Added an answer on May 14, 2026 at 9:02 am
    • PersistentManagerFactory will give you a new PersistenceManager every time you ask for it.
    • If the app doesn’t deal with too many requests, you’re okay.
    • If the app deals with lots of requests, you might either get:
      1. Some sort of Exception (PMF refuses to give more PM)
      2. Billed more by Google (inefficient)

    There are 2 ways to use PM to perform operations to multiple objects:

    • Batch processing (Create, Update, Delete multiple objects)
    • Transaction (Execute one or more business logics/rules and persist)

    Batch processing is limited to objects with the same type while transaction is limited to entities of the same group.

    Some advises:

    • Always close your PM
    • Alternatively you can use the detach mechanism if you want to use the objects after you close the PM (i.e. you want JSP to render a list of objects, but your servlet already close your PM)

    I hope this help.

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

Sidebar

Ask A Question

Stats

  • Questions 489k
  • Answers 489k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, is this at all possible? With simple user --SSH-->… May 16, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer Just like IQueryable lets you not double-evaluate an expression when… May 16, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer Yes, but not in HTML. You will need to run… May 16, 2026 at 8:59 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some code like this: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Save([Bind(Prefix=)]Person person) { String s
I have some code like this in a winforms app I was writing to
I have some code like this: If key.Equals(search, StringComparison.OrdinalIgnoreCase) Then DoSomething() End If I
I have some code like this: doDatabaseFetch { ... @synchronized(self) { ... } }
I have some code like this to take over the space bar's function: $(document).keypress(function
I have some code like this: if (condition) { var variable = blah; }
I have some code like this: Dim col As Collection = New Collection col.Add(value1,
I have some code like this: <a href=<%= Html.ActionLink( e.Member.UserName, profile, members, new {username
I have some code like this (this is a simplified example): function callback_func($matches) {

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.