---
title: "hibernate中htm.xml注意的一个问题"
author: "cheer_nice"
date: "2011-06-08T12:00:43Z"
tags: []
categories: ["企业架构"]
slug: "hibernate-htm-xml"
draft: false
lastmod: "2011-06-08T12:00:43Z"
id: 1072761
url: "https://cheer-nice.iteye.com/blog/1072761"
---

遇到了这个问题  总是报 

# org.hibernate.MappingException: Could not read mappings from resource

这个错误  在hibernate.cfg.xml中 注释掉相应的 那行就ok

仔细检查了那个xxx.hbm.xml  都没有问题 表名  类名都没问题

很郁闷 

 

最后竟然是 因为那个xml文件 在最顶上 有了两个空格 因此出了问题。。。

 

&lt;?xml version="1.0"?&gt; 即这一行 要顶在最上面。。。