hibernate加载实体映射文件 及映射文件auto-import

第一种方法:

    在hibernate.cfg.xml中<mapping resource="包名/Xxx.hbm.xml"/>包名为路径形式( x/x/x这种形式)

第二种方法:

    new Configuration().configure().addClass(类名.class); 会自动加载类名.hbm.xml文件

 

<hibernate-mapping package="包名" auto-import="Xxx">

当auto-import="false" 时 hql语句是  from 类的全名(包括包名)

当auto-import="true" hql语句是  from 类名(不用包括包名)

posted @ 2016-04-30 21:54  李永  阅读(543)  评论(0编辑  收藏  举报