3 Replies Latest reply on Feb 14, 2008 3:59 AM by alrubinger

    Null value was assigned to a property of primitive type sett

    phon

      Hi,

      i get this error when i try to load an entity:

      14:31:25,319 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of

      the property is of type boolean.

      the strange thing is that the column in the DB has a value in it, it's certainly not null.

      this problem goes away if i set Boolean (the wrapper class) as type, but then i got null values , which is not good because there IS data in de DB table

      anyone?

        • 1. Re: Null value was assigned to a property of primitive type
          mr.colin.daly



          fuck this
          fuck jboss
          fuck jboss forums
          what is the fucking point
          no one answers any fucking questions
          this is about the 6th perfect question i.e
          one fitting my exact circumstance with no
          fucking answer. fucking professional open source.
          it sux.

          • 2. Re: Null value was assigned to a property of primitive type
            mr.colin.daly


            did i say that...
            or just think it

            • 3. Re: Null value was assigned to a property of primitive type
              alrubinger

               

              "mr.colin.daly" wrote:
              fuck this


              Gee, you sound frustrated.

              14:31:25,319 INFO [DefaultLoadEventListener] Error performing load command
              org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of (boolean)
              


              Let's tackle the code first.

              This is a pretty informative error message. Primitive types cannot be null. So if you're performing a load from the DB, and the field doesn't have a NOTNULL constraint, you can have null values, which Hibernate will attempt to assign to your variable of primitive type.

              So I'd recommend some validation to ensure nulls are not allowed in the field, there's a default to the DB, or your field is of type Boolean.

              Of course, it's been asserted:

              "phon" wrote:
              the strange thing is that the column in the DB has a value in it, it's certainly not null.


              ...this is indeed strange.

              Now let's move on to possibilities why no one had answered the original post.

              * The community did not believe that the value in the DB is non-null; it is more likely a user error.
              * The community has not seen this error, and does not know the answer.
              * Someone who does know the answer has not seen the post.
              * The post is in the wrong place. This is much better placed either in Hibernate or our JPA forums, where entity knowledge is stronger.

              "mr.colin.daly" wrote:
              fucking professional open source.
              it sux.


              Our products are free. We produce documentation and offer support to the community limited by the availability of our personal time.

              If your needs are urgent, I'd recommend looking into our service offerings, which will guarantee that a well-qualified CS100 student explains to you why the construct:

              boolean flag = null;


              ...is not valid syntax.

              I therefore invite you to prove me wrong by providing a trim sample project with source and build isolating this problem. If a bug is suspected, the burden of proof lies with the reporter. Otherwise, the team would be bottlenecked investigating false issues.

              If I am indeed incorrect in assuming you've messed up somewhere, then it turns out that the open source project you've obtained without guarantee or tariff is faulty, and you've done the community a great service in reporting the error. You may further investigate the underlying cause for the bug and recommend a patch via our issue-tracking system. If that's the case, you'll have my apologies for lack of belief in a real issue.

              S,
              ALR

              PS - Schmuck.