title: org.hibernate.HibernateException: Missing column
body: <p>I am using Spring 3 and Hibernate 4 in my Application with Maven. I am getting some issues which are due to Hibernate Mapping so i am working on it. But now i am stuck and unable to find the solution. please correct me if i am doing something wrong. My entity class is where i have written my NamedQuery:-</p>
  
  <pre><code>    @Entity
  
         @NamedQuery(
              name = "findAllProduct",
              query = "from PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION pvpo"
              +" INNER JOIN pvpo.pcvId  pcv" 
              +" INNER JOIN pcv.productCatalogId pc"
              +" INNER JOIN pc.productCatalogId id"
              +" INNER JOIN pvpo.pincode pin"
              +" where id = :id"
              )
  
  
          public class PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION extends baseEntity.Entity {
  
              @Id
              @GeneratedValue(strategy=GenerationType.AUTO)
              private int id;
  
              @Column(name="Payment_Id")
              @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER,mappedBy="id") 
              private Set&lt;Product_Catalog_Vendor&gt; pcvId; 
  
  
              @Column(name="pincode_id")
              @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER,mappedBy="pincode_id")
              private Set&lt;Pincodes&gt; pincode;          
  
  
        @Column(name = "PAYMENT_OPTIONS")
              @OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER,mappedBy="paymentOptions") 
              private Set&lt;Payment_Options&gt; paymentOptions;
          //setter getter
          }
  </code></pre>
  
  <p>My Payment_Options class is:-</p>
  
  <pre><code>@Entity
  @Table(name="payement_options")     
  public class Payment_Options extends baseEntity.Entity {
  
      @Id
      @JoinColumn(name="PAYMENT_OPTIONS") 
      private int paymentOptions;
  
      @Column(name="Description")
      private String description;
  //Setter Getter
  }
  </code></pre>
  
  <p>PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION and PAYMENT_OPTIONS Table in database:-</p>
  
  <pre><code>    CREATE TABLE PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION (
        ID INTEGER UNSIGNED  NOT NULL   AUTO_INCREMENT,
        Payment_Id INTEGER UNSIGNED  NOT NULL  ,   
        PINCODE_ID INTEGER UNSIGNED  NOT NULL  ,
        PAYMENT_OPTIONS INTEGER UNSIGNED NOT NULL ,   
      PRIMARY KEY(ID,Payment_Id, PINCODE_ID)  , 
      INDEX PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION_FKIndex1(PAYMENT_OPTIONS),
      INDEX PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION_FKIndex2(Payment_Id)  ,
      INDEX PRODUCT_VENDOR_PAYMENT_OPTION_LOCATION_FKIndex3(PINCODE_ID),
        FOREIGN KEY(PAYMENT_OPTIONS)   
        REFERENCES PAYEMENT_OPTIONS(PAYMENT_OPTIONS)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
        FOREIGN KEY(Payment_Id)
          REFERENCES PRODUCT_CATALOG_VENDOR(Id)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION,
        FOREIGN KEY(PINCODE_ID)
          REFERENCES PINCODES(PINCODE_ID)
            ON DELETE NO ACTION
            ON UPDATE NO ACTION);
  
  ...
  
      CREATE TABLE PAYEMENT_OPTIONS (
        PAYMENT_OPTIONS INTEGER UNSIGNED  NOT NULL   AUTO_INCREMENT,
        Description VARCHAR(500)  NULL    ,
      PRIMARY KEY(PAYMENT_OPTIONS));
  </code></pre>
  
  <p>I am getting below error at deployement time. Provide me some solution on below. Thanks!</p>
  
  <pre><code>18:12:26,614 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-3) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6e677ea2: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,productController,usermanagementHibernateProperties,jspViewResolver,usermanagementSessionFactory,usermanagementDataSource,city,state,country,pincodes,notification,notification_types,transactions,address,user_master,notification_channels,notification_time,prefilled_response,payment_options,catagory,vendor,requester,requirement_type,discount_offer_type,discount_offers,requirements,product_catalog,product_catalog_vendor,product_vendor_payment_option_location,baseDaoImpl,productDAO,productService,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
  18:12:26,624 SEVERE [org.springframework.web.servlet.DispatcherServlet] (MSC service thread 1-3) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecom.data.access.transaction.ProductService com.ecom.data.access.controller.ProductController.productService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecom.data.access.product.ProductDAO com.ecom.data.access.transaction.ProductServiceImpl.productDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.ecom.data.access.product.ProductDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usermanagementSessionFactory' defined in class path resource [applicationContext-usermanagement-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: paymentOptions in 2402.payement_options
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [spring-context-3.2.2.RELEASE.jar:]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [spring-context-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651) [spring-webmvc-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599) [spring-webmvc-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665) [spring-webmvc-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518) [spring-webmvc-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459) [spring-webmvc-3.2.2.RELEASE.jar:]
      at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) [spring-webmvc-3.2.2.RELEASE.jar:]
      at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.1.Final.jar:7.0.2.Final]
      at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [:1.6.0_43]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [:1.6.0_43]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_43]
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecom.data.access.transaction.ProductService com.ecom.data.access.controller.ProductController.productService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecom.data.access.product.ProductDAO com.ecom.data.access.transaction.ProductServiceImpl.productDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.ecom.data.access.product.ProductDaoImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'usermanagementSessionFactory' defined in class path resource [applicationContext-usermanagement-dao.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: paymentOptions in 2402.payement_options
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) [spring-beans-3.2.2.RELEASE.jar:]
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) [spring-beans-3.2.2.RELEASE.jar:]
      ... 27 more
  </code></pre>