JPA + Hibernate MySql数据库架构更改没有反映出来

时间:2014-04-21 05:30:24

标签: java mysql spring hibernate jpa

在我的春季网络服务中,我正在使用JPA + Hibernate访问我的sql数据库。当我在数据库中更改数据库架构时,这些更改不会反映在我的Web服务中。

更详细地说,我在applicationforms表中添加了一个新列formcategoryid,并将其作为字段添加到JPA注释类中。现在我执行查询

 SELECT x.formid,x.formcategoryid,x.formname FROM com.business.objects.ApplicationForms AS x WHERE x.adminroleid LIKE '3'

它给出了例外,

Caused by: org.hibernate.QueryException: could not resolve property: formcategoryid of: com.business.objects.ApplicationForms

对此有什么想法吗?


更新

我的ApplicationForms类就像

    package com.business.objects;

    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;

    @Entity
    @Table(name = "applicationforms")
    public class ApplicationForms {

        @Id
        @GeneratedValue
        private int formid;
        private int formcategoryid;
        private int adminroleid;
        private String formname;
        .
        .


        public int getFormid() {
            return formid;
        }

        public void setFormid(int formid) {
            this.formid = formid;
        }



        public int getFormcategoryid() {
            return formcategoryid;
        }

        public void setFormcategoryid(int formcategoryid) {
            this.formcategoryid = formcategoryid;
        }

        public int getAdminroleid() {
        return adminroleid;
        }

        public void setAdminroleid(int adminroleid) {
        this.adminroleid = adminroleid;
        }

        public String getFormname() {
        return formname;
        }

        public void setFormname(String formname) {
        this.formname = formname;
        }

}

0 个答案:

没有答案