entity,HibernateTool生成Entity Bean和Session Bean并在JBOSS中运行,遇到的问题

一、HibernateTool生成Entity Bean和Session Bean的大概步骤
1. 新建Project->Dynamic Web Project
2. 新建Hibernate Configuration File
3. 新建Hibernate Console Configuration
4. 新建Hibernate Reverse Engineering File
5. 打开Hibernate图,配置Configuration
二、遇到错误一
DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport] create table STUDENT (STUD_ID integer generated by default as identity (start with 1), STUD_NAME varchar(255), primary key (STUD_ID))
ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] Unsuccessful: create table STUDENT (STUD_ID integer generated by default as identity (start with 1), STUD_NAME varchar(255), primary key (STUD_ID))
找了好办天,原来是persistence.xml中的一个选项设置错误了
value="org.hibernate.dialect.MySQLDialect"/>
三、遇到错误二
failed to resolve schema binding for QName persistence with schemaLoacation = persistence…
真的把人搞死了,最后是Jboss版本的问题,在Jboss高版本中,对persistence.xml的定义有严格的要求,
"http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
有些东西不能少!!!
Tags:  entity

延伸阅读

最新评论

发表评论