运行junit单元测试报错:org.hibernate.MappingException: Could not determine type for: String, at table: Elec_T

org.hibernate.MappingException: Could not determine type for: String, at table: Elec_Text, for colum

hibernate配置文件出问题,导致连接不上数据库,检查运行hbm.xml文件,发现String类型对于java可以,但hibernate要用string,小写的“s”,这样子就解决问题了,运行单元测试成功。




阅读更多

org.hibernate.MappingException: Could not determine type for: string , at table

11-18

Books.javarn[code=Java]rnpackage com.ssh.books.model;rnrnimport java.sql.Date;rnrnpublic class Books rn private String bookId;rn private String name;rn private String author;rn private String publish;rn private Date date;rn private String isbn;rn private int page;rn private String bookPrice;rn private String content;rn rn rnrn public String getBookId() rn return bookId;rn rn public void setBookId(String bookId) rn this.bookId = bookId;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rn public String getAuthor() rn return author;rn rn public void setAuthor(String author) rn this.author = author;rn rn public String getPublish() rn return publish;rn rn public void setPublish(String publish) rn this.publish = publish;rn rn public Date getDate() rn return date;rn rn public void setDate(Date date) rn this.date = date;rn rn public String getIsbn() rn return isbn;rn rn public void setIsbn(String isbn) rn this.isbn = isbn;rn rn public int getPage() rn return page;rn rn public void setPage(int page) rn this.page = page;rn rn public String getBookPrice() rn return bookPrice;rn rn public void setBookPrice(String bookPrice) rn this.bookPrice = bookPrice;rn rn public String getContent() rn return content;rn rn public void setContent(String content) rn this.content = content;rn rnrnrnrnrnBooks.hbm.xmlrn[/code]rnrn[code=XML]rnrnrnrnrnrnrn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnrnrn[/code]rnrnrn[color=#FF0000]rnCaused by: org.hibernate.MappingException: Could not determine type for: string , at table: books, for columns: [org.hibernate.mapping.Column(book_id)]rn[/color]

没有更多推荐了,返回首页