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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:33:47+00:00 2026-06-13T05:33:47+00:00

I have a class Shop with the following variable @Column(columnDefinition = bit) private boolean

  • 0

I have a class Shop with the following variable

@Column(columnDefinition = "bit")
private boolean atShop;

Using this value, I am using HSQL to retrieve this information from the application

from Person person
left join fetch person.shop

when I try call this HSQL statement i get the following error

org.springframework.orm.hibernate3.HibernateSystemException: could not set a field value by reflection setter of com.test.dataobject.Shop.atShop; nested exception is org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.test.dataobject.Shop.atShop

It is throwing this because it is trying to set the boolean to null in the HSQL. I can solve this problem by changing private boolean atShop; to private Boolean atShop; but i want to keep this as a boolean as i am saving it as a bit in my database

Is there a way to solve this without changing boolean to Boolean?

EDIT:

I know that boolean can only be true/false and Boolean can be set to null, but is there a way to get hibernate/spring to set this value to false(which i thought it should do automatically) instead of trying to set it to null and throwing this exception?

I have also tried adding annotation to automatically set the value to false but this does not work either

@Column(nullable = false, columnDefinition = "bit default 0")
private boolean atShop;
  • 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-13T05:33:48+00:00Added an answer on June 13, 2026 at 5:33 am

    – boolean is a primitive type, and can have a value of only true or false.

    – Whereas Boolean is a Wrapper Object and can be given a null value.

    – From Java 1.5 AutoBoxing is provided, so you can convert boolean to Boolean and back to boolean with Simple assignment operator (=), So you can do this in places where you want Boolean instead of boolean.

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

Sidebar

Related Questions

Hi (huge Rails newbie here), I have the following models: class Shop < ActiveRecord::Base
I have following structure: class Delivery < ActiveRecord::Base belongs_to :shop end and class Shop
I have the following models: class Aircon < ActiveRecord::Base belongs_to :shop belongs_to :brand belongs_to
I have the following models: class Aircon < ActiveRecord::Base belongs_to :shop belongs_to :brand belongs_to
I have the following two models: class Product < ActiveRecord::Base belongs_to :shop validates_numericality_of :price,
I have the following code inside the _forms view. <div class=field> Shop: <%= f.collection_select
I have one problem Looking below: I have this model: class Shoes(models.Model): shop =
I have class with back reference: public class Employee : Entity { private string
I have class with collection as below public class MyClass:IXmlSerializable { int vesrion; private
I have class like this below shown. which contains the shopping items where 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.