課程
/后端開(kāi)發(fā)
/Java
/Hibernate初探之單表映射
求指教到底哪里錯(cuò)了
2016-01-07
源自:Hibernate初探之單表映射 1-11
正在回答
http://blog.csdn.net/u010150082/article/details/9527355
你采用的注冊(cè)方法,被取消了。應(yīng)該是這個(gè)問(wèn)題。
目錄結(jié)構(gòu)沒(méi)有錯(cuò),那多半就是在初始化的時(shí)候搞錯(cuò)了,導(dǎo)致沒(méi)有讀到Students的配置文件。
聽(tīng)雨2015 提問(wèn)者
Its_forever 回復(fù) 聽(tīng)雨2015 提問(wèn)者
StandardServiceRegistry?standardRegistry?=?new?StandardServiceRegistryBuilder() ????????.configure() ????????.build(); ? Metadata?metadata?=?new?MetadataSources(?standardRegistry?) ????????.getMetadataBuilder() ????????.applyImplicitNamingStrategy(?ImplicitNamingStrategyJpaCompliantImpl.INSTANCE?) ????????.build(); ? sessionFactory?=?metadata.getSessionFactoryBuilder() ????????.build();
從5.0.7 release的documentation里查找到的方法,實(shí)測(cè)可用。
具體信息在:hibernate-release-5.0.7.Final\documentation\userGuide\en-US\html\ch03.html中可用詳細(xì)查看
StandardServiceRegistry?standardRegistry?=?new?StandardServiceRegistryBuilder() .configure() .build(); Metadata?metadata?=?new?MetadataSources(?standardRegistry?) .getMetadataBuilder() .applyImplicitNamingStrategy(?ImplicitNamingStrategyJpaCompliantImpl.INSTANCE?) .build(); sessionFactory?=?metadata.getSessionFactoryBuilder() .build();
這個(gè)是從5.0.7 release的documentation里查找到的方法,實(shí)測(cè)可用。
你的映射文件(Student.hbm.xml) 沒(méi)有被映射
換個(gè)目錄嘛,把Student.hbm.xml放到hibernate.cfg.xml的目錄下試一試。
舉報(bào)
Java持久化框架Hibernate入門教程,掌握Hibernate基本概念
4 回答junit測(cè)試出錯(cuò)org.hibernate.MappingException: Unknown entity: com.entity.Student
4 回答 org.hibernate.MappingException: Unknown entity
2 回答org.hibernate.MappingException: Unknown entity: com.entity.Student
4 回答org.hibernate.MappingException: Unknown entity: Students
2 回答org.hibernate.MappingException: Unknown entity: com.imooc.hibernate.Students測(cè)試錯(cuò)誤
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-01-07
http://blog.csdn.net/u010150082/article/details/9527355
你采用的注冊(cè)方法,被取消了。應(yīng)該是這個(gè)問(wèn)題。
目錄結(jié)構(gòu)沒(méi)有錯(cuò),那多半就是在初始化的時(shí)候搞錯(cuò)了,導(dǎo)致沒(méi)有讀到Students的配置文件。
2016-01-17
從5.0.7 release的documentation里查找到的方法,實(shí)測(cè)可用。
具體信息在:hibernate-release-5.0.7.Final\documentation\userGuide\en-US\html\ch03.html中可用詳細(xì)查看
2016-01-17
這個(gè)是從5.0.7 release的documentation里查找到的方法,實(shí)測(cè)可用。
具體信息在:hibernate-release-5.0.7.Final\documentation\userGuide\en-US\html\ch03.html中可用詳細(xì)查看
2016-01-07
你的映射文件(Student.hbm.xml) 沒(méi)有被映射
換個(gè)目錄嘛,把Student.hbm.xml放到hibernate.cfg.xml的目錄下試一試。