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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:18:37+00:00 2026-05-27T07:18:37+00:00

I am using hibernate. When I try to insert values into my db I

  • 0

I am using hibernate. When I try to insert values into my db I am getting error.

Here is the stack trace

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'postalCode' in 'field list'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

Here is a overview of my Pojo class

 @Entity 
    public class HeadOffice implements java.io.Serializable 
{


private Long officeId;  
private String name;    
private String addr1;   
private String addr2;   
private String postalCode;  
private String country;     
private String email;   
private String tel1;    
private String tel2;

public HeadOffice() { }

public String getPostalCode() 
{       
   return this.postalCode;  
}

public void setPostalCode(String postalCode) 
 {      
    this.postalCode = postalCode;   
     }
}

And this is the corresponding entry for the postal code property in the hbm.xml file

<property name="postalCode" type="string">
            <column name="postal_code" length="24" not-null="true" />
        </property>

during sql query exceqution the field name is taken as postalCode instead of postal_code

How can I correct this?
Thanks

  • 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-27T07:18:37+00:00Added an answer on May 27, 2026 at 7:18 am

    You seem to be mixing up annotation-style configuration and XML-style configuration. While this is possible, it’s rarely the intention.

    I suspect that your configuration is simply ignoring the .hbm.xml file and taking the config from your annotated class instead.

    Try either:

    1. removing @Entity from your class, or
    2. adding @Column(name="postal_code") to the getPostalCode() method.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DAO class which I'm using to try select/update/insert with hibernate and
I have made an application using Java/Hibernate/MySQL, but whenever I try running it, it
I'm using Hibernate 3.2.1 and database SQLServer2000 while I'm try to insert some data
I am unable to create a table and insert the values into it using
Does anyone know about this error I get when I try to insert a
I'm having problems using Hibernate and SQL Server 2008. When I try to save
I am using hibernate to insert objects of the class meal in a hsql
I try to build some application using hibernate for persistence (my first one). The
I am using JPA with Hibernate underneath, and I am having trouble getting merge
I'm using Hibernate JPA and Spring in my project. Suppose if I try to

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.