使用的是hibernate5的方法:

ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

没有获得导致配置文件中信息:

<mapping resource="com/hibernate2/pojo/News.hbm.xml"/>

添加:

Configuration configuration = new Configuration().configure();
configuration.addResource("com/hibernate2/pojo/News.hbm.xml");
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

暂时解决;

或者使用hibernate4的方法

ServiceRegistry serviceRegistry =
new ServiceRegistryBuilder().applySettings(configuration.getProperties())
.buildServiceRegistry();

org.hibernate.UnknownEntityTypeException: Unable to locate persister: com.hibernate2.pojo.News at org.hibernate.internal.SessionFactoryImpl.locateEntityPersister(SessionFactoryImpl.java:797)的更多相关文章

  1. 【Hibernate】Unable to locate appropriate constructor on class原因分析

    通常我们喜欢将hql查询结果封装到POJO对象syntax:select new POJO(id,name) from POJO ; 这种封装需要POJO类提供对应构造器,POJO(id,name)构 ...

  2. NHibernet Unable to locate persister for the entity

    第一 xml文件必须为 *.hbm.xml 第二  设置xml文件为嵌入的资源,用鼠标点击右键 然后生成操作里 选择嵌入的资源即可解决. https://www.cnblogs.com/lyj/

  3. 使用hibernate时出现 org.hibernate.HibernateException: Unable to get the default Bean Validation factory

    hibernate 在使用junit测试报错: org.hibernate.HibernateException: Unable to get the default Bean Validation ...

  4. E: Unable to locate package openjdk-8-jdk 及java version 切换

    在unbuntu14.04系统上安装 Open JDK 8 时遇到了如下问题: $ -jdk Reading package lists... Done Building dependency tre ...

  5. Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testAction': ...

  6. Hibernate异常:Unable to locate appropriate constructor on class

    异常信息:org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class o ...

  7. Unable to locate appropriate constructor on class报错

    在项目开发中,使用Hibernate里的JPA criteria查询,但是在写完之后使用时,会报错:Unable to locate appropriate constructor on class, ...

  8. org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

    使用Hibernate 插入List数据时出现了以下异常: SLF4J: The requested version 1.6 by your slf4j binding is not compatib ...

  9. adcfgclone.pl appsTier报错Unable to locate 'linkxlC' utility in path

    $ cd /u01/dev/apps/apps_st/comn/clone/bin$ perl adcfgclone.pl  appsTier                     Copyrigh ...

随机推荐

  1. Java实现斗地主发牌(Collections工具类的应用)

    package com.doudou_01; import java.util.ArrayList; import java.util.Collections; import java.util.Li ...

  2. 【原创】标准HTTP请求工具类

    以下是个人在项目开发过程中,总结的Http请求工具类,主要包括四种: 1.处理http POST请求[XML格式.无解压]: 2.处理http GET请求[XML格式.无解压]: 3.处理http P ...

  3. LinuxMint 18.3禁用ipv6

    编辑/etc/sysctl.conf文件,添加如下内容 net.ipv6.conf.all.disable_all = 1 保存后执行 sudo sysctl -p 即可生效

  4. 零基础学python之函数与模块(附详细的代码和安装发布文件过程)

    代码重用——函数与模块 摘要:构建函数,创建模块,安装发布文件,安装pytest和PEP 8插件,确认PEP8兼容性以及纠错 重用代码是构建一个可维护系统的关键. 代码组是Python中对块的叫法. ...

  5. Extreme Learning Machine 翻译

    本文是作者这几天翻译的一篇经典的ELM文章,是第一稿,所以有很多错误以及不足之处. 另外由于此编辑器不支持MathType所以好多公式没有显示出来,原稿是word文档. 联系:250101249@qq ...

  6. users命令详解

    基础命令学习目录 原文链接:https://blog.csdn.net/m0_38132420/article/details/78861464 users命令用于显示当前登录系统所有的用户的用户列表 ...

  7. centos7安装oracle亲测可用

    http://www.linuxidc.com/Linux/2016-04/130559p2.htm

  8. Alpha发布PSP Daily评价总结报告

    Alpha发布PSP Daily评价总结报告 优点: 1.用户人群较为明确,定位较为准确. 2.亮点:暂停任务时是无法结束当前任务的. 3.说明书写的详细.语言流畅.能实现的功能都体现出来. 4.下拉 ...

  9. Thunder-Beta发布-事后诸葛亮会议-2017秋-软件工程第十一次作业

    小组名称:Thunder项目名称:爱阅APP小组成员:王航 李传康 翟宇豪 邹双黛 苗威 宋雨 胡佑蓉 杨梓瑞一.设想和目标 1.我们的软件要解决什么问题?是否定义得很清楚?是否对典型用户和典型场景有 ...

  10. OO学习总结与体会

    前言 经过了对于面向对象程序设计的一个月的学习,我初尝了JAVA以及面向对象程序的魅力.经历了三次难度逐渐加大的课后编程作业,我对于工程化面向对象编程以及调试有了深刻的认识与颇多感想.我写下本篇文章以 ...