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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:02:28+00:00 2026-05-26T21:02:28+00:00

I have a JPA domain entity that I’m updating from user input. Depending on

  • 0

I have a JPA domain entity that I’m updating from user input. Depending on lots of factors about that object, it has actions to perform when it’s updated (in this case, the update is to “mark it completed”).

In the database, two “post-completion action configuration” fields (note and next_workflow) are nullable, and either have a value of interest, or are NULL. There may be very many of these, but I’m starting with these two.

I wrote the following method in the model class:

@PostUpdate
public void gotUpdate() {
    System.out.println("Got post update for " + this.getDescription());
    if (! this.getNote().isEmpty()) {
        Note n = new Note();
        n.setAssetId(this.getAssetId());
        n.setNotifyLessor(1);
        n.setNote(this.getLessorNote() + this.getCapturedData());
        n.setCreatedDate(new Date());
        n.persist();
    }
    System.out.println("In the middle of post update for " + this.getDescription());
    if (this.getNextWorkflow() != 0) {
        Asset a = this.getAssetId();
        a.setWorkflowId(Workflow.findWorkflow(this.getNextWorkflow()));
        a.merge();          
    }
    System.out.println("Finishing post update for " + this.getDescription());
}

For entities with NULL “note” values, the console output is:

Got post update for this item

For entities with non-NULL “note” values and with NULL “nextWorkflow” values, the console output is:

Got post update for this item
In the middle of post update for this item

No errors anywhere, no stack dump, no nothing. The method just silently quits, AND the merge I’m doing on this entity doesn’t complete (the database remains unchanged).

Stepping through this in the debugger gets to that line where things are being tested, and if the value is NULL, it pops a tab saying “Source not found”, which I don’t really know what to make of. I think that’s just the debugger saying it can’t step into something, but I’m not actually asking it to…

  • 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-26T21:02:29+00:00Added an answer on May 26, 2026 at 9:02 pm

    Rookie question, it turns out.

    If Object‘s field field is null, then object.getField().length() is a call to a null pointer.

    The answer is to test the field for nullness, not some side-effect of nullness.

    if (! (this.getNote() == null)) {
    ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a domain object class User (it is a JPA entity): @Entity public
I would like to have a JPA Entity that has a GSon Object as
I have a JPA object which has a many-to-many relationship like this: @Entity public
A have a JPA entity that has timestamp field and is distinguished by a
I have a some JPA entities that inherit from one another and uses discriminator
We have a project that uses JPA/Hibernate on the server side, the mapped entity
We have an JPA @Entity class (say User) which has a @ManyToOne reference (say
I have a domain object that stores some metadata and some raw bytes. This
I have the following java class: package domain; //imports @Entity public class User {
I have a JPA entity class with a composite primary key (uid,lid) that in

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.