person is not mapped--.整合Hibernate出现错误 2C

图片说明
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**

  • Created by on 2017/1/16.
    */
    @Entity
    @Table(name="person")
    public class Person {

    private String id;
    private String name;
    private String idCard;
    private String phone;
    private String address;

    @Id
    @Column(name = "id",nullable = false,length = 32,unique = true)
    @GenericGenerator(name = "generator",strategy = "uuid.hex")
    @GeneratedValue(generator = "generator")
    public String getId() {
    return id;
    }

    public void setId(String id) {
    this.id = id;
    }

    @Column(name="name",nullable = false,length = 32)
    public String getName() {
    return name;
    }

    public void setName(String name) {
    this.name = name;
    }
    @Column(name="idCard",nullable = false,length = 32)
    public String getIdCard() {
    return idCard;
    }

    public void setIdCard(String idCard) {
    this.idCard = idCard;
    }
    @Column(name="phone",nullable = false,length = 32)
    public String getPhone() {
    return phone;
    }

    public void setPhone(String phone) {
    this.phone = phone;
    }
    @Column(name="address",nullable = false,length = 32)
    public String getAddress() {
    return address;
    }

    public void setAddress(String address) {
    this.address = address;
    }
    }


3个回答

查看包名,是不是在自动扫描的包符合

sinat_24091517
sinat_24091517 配置文件没看到有错误
3 年多之前 回复

检查Hibernate配置文件 看一下写错没

sinat_24091517
sinat_24091517 配置文件已经上传 没看到有错误
3 年多之前 回复

实体类是反映射生成的?如果先配置spring的话,并且没有hiernate的配置文件,再用hibernate反映射,就会自动更新spring的配置

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问