Attribute "column" must be declared for element type "property"解决办法

hibernate,自己写的xxx.hbm.xml文件 出现错误:
Attribute "column" must be declared for element type "property"

   头部文件为
hibernate.cfg.xml的:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

   这个应该改为mapping的头文件就行了
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
          "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net /hibernate-mapping-3.0.dtd">
阅读更多

求解Attribute "namespace" must be declared for element type "sqlMapConfig"

04-07

rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn-------------------------------------------------------------------------rnrnrnrn rn rn rn select name,sex from t_user where name=#name#rn rn rn rn rn update t_user set name=#name#,sex=#sex# where id=#id#rn rn rn rn rn insert into t_user(name,sex) values(#name#,#sex#) rn rn rn rn rn delete from t_user where id="#id"rn rn rnrn------------------------------------------------------------------------------------rnpublic static void main(String[] args) throws IOException, SQLExceptionrn String resource="SqlMapConfig.xml";rn Reader reader;rn reader = Resources.getResourceAsReader(resource);rn XmlSqlMapClientBuilder xmlBuilder = new XmlSqlMapClientBuilder();rn SqlMapClient sqlMap = xmlBuilder.buildSqlMap(reader);rn try rn sqlMap.startTransaction();rn User user = new User();rn user.setId(new Integer(1));rn user.setName("zhangSan");rn user.setSex(new Integer(0));rn sqlMap.insert("User.insertUser", user);rn sqlMap.commitTransaction();rn catch (Exception e) rn e.printStackTrace();rn finallyrn sqlMap.endTransaction();rn rn rn--------------------------------------------------------------------rn运行报错:rnException in thread "main" com.ibatis.sqlmap.client.SqlMapException: There was an error while building the SqlMap instance. rn--- The error occurred in com/maesinfo/lxl/entity/User.xml. rn--- The error occurred while loading the SQL Map resource. rn--- Cause: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error. Cause: org.xml.sax.SAXException: Error: URI=null Line=5: Attribute "namespace" must be declared for element type "sqlMapConfig".rnCaused by: org.xml.sax.SAXException: Error: URI=null Line=5: Attribute "namespace" must be declared for element type "sqlMapConfig".rnCaused by: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error. Cause: org.xml.sax.SAXException: Error: URI=null Line=5: Attribute "namespace" must be declared for element type "sqlMapConfig".rnCaused by: org.xml.sax.SAXException: Error: URI=null Line=5: Attribute "namespace" must be declared for element type "sqlMapConfig".rn at com.ibatis.sqlmap.engine.builder.xml.XmlSqlMapClientBuilder.buildSqlMap(XmlSqlMapClientBuilder.java:243)rnrn我是新手,麻烦各位大哥看看,我该怎么配置才运行得出效果。

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