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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:44:30+00:00 2026-06-12T06:44:30+00:00

i’m trying to validate a new bean object using the jpa validation. I’m getting

  • 0

i’m trying to validate a new bean object using the jpa validation.

I’m getting this error:

2012-09-24 11:19:55,584 WARN  [AbstractModel:32] The object is not persisted yet, this operation requires the object to already be persisted.
java.lang.Exception
        at org.oscarehr.common.model.AbstractModel.hashCode(AbstractModel.java:32)
        at org.hibernate.validator.engine.ConstraintViolationImpl.hashCode(ConstraintViolationImpl.java:127)
        at java.util.HashMap.put(HashMap.java:389)
        at java.util.HashSet.add(HashSet.java:217)
        at java.util.AbstractCollection.addAll(AbstractCollection.java:322)
        at java.util.HashSet.<init>(HashSet.java:117)
        at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:120)
        at org.apache.jsp.billing.CA.ON.reports.billingONNewReport_jsp.saveSubmittedBills(billingONNewReport_jsp.java:383)
        at org.apache.jsp.billing.CA.ON.reports.billingONNewReport_jsp._jspService(billingONNewReport_jsp.java:796)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
        at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
        at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680)
        at org.apache.jsp.billing.CA.ON.billingONReport_jsp._jspService(billingONReport_jsp.java:109)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
....

I’m using:

hibernate-entitymanager 3.4.0.GA
hibernate-validator 4.1.0.Final
validation-api 1.0.0.GA

I’m calling my validation code like this:

Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
                Set<ConstraintViolation<BillingClaimHeader1>>  constraintViolations = validator.validate(newBill);
                MiscUtils.getLogger().info("num violations: " + constraintViolations.size());

Where newBill is a new instance of class BillingClaimHeader1.

Here’s the class definition for BillingClaimHeader1:

public class BillingClaimHeader1 extends AbstractModel<Integer> implements Serializable

I’m pretty new to the whole JPA/validation thing, but I didn’t realize that I had to persist an object BEFORE validating it…seems kind of counter-intuitive..

I appreciate any help!

cheers

Jarrett

  • 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-06-12T06:44:31+00:00Added an answer on June 12, 2026 at 6:44 am

    Note that

    1. This message comes from org.oscarehr.common.model.AbstractModel, not JPA
    2. It’s a warning, not an error

    Actually, you can safely ignore this message in your case.

    org.oscarehr.common.model.AbstractModel uses entity identifier to implement equals() and hashCode(). This approach has one disadvantage when used with generated identifiers – it breaks the contract of equals() and hashCode() when you save an object, i.e. hashCode() of a transient object differs from hashCode() of the same object after you saved it.

    To inform you about possible problems authors of org.oscarehr.common.model.AbstractModel decided to emit a warning when you call hashCode() on a transient object. However, in your case you can safely ignore this warning, because hashCode() is called internally by validation routines that operate on transient objects only (as far as I understand).

    See also:

    • Equals and HashCode
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.