Hibernate - ServiceRegistryBuilder

前端 未结 9 1876
眼角桃花
眼角桃花 2020-12-28 08:30

I\'m just trying to learn Hibernate (version 4 final) but I have a problem when trying to create the session factory. Here is some code related to the problem:

hi

9条回答
  •  無奈伤痛
    2020-12-28 09:00

    for the below error :

    Oct 09, 2015 12:29:53 AM org.hibernate.Version logVersion
    INFO: HHH000412: Hibernate Core {5.0.2.Final}
    Oct 09, 2015 12:29:53 AM org.hibernate.cfg.Environment 
    INFO: HHH000206: hibernate.properties not found
    Oct 09, 2015 12:29:53 AM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: HHH000021: Bytecode provider name : javassist
    Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]
        at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)
        at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:259)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:245)
        at org.hibernate.ClientResource.ClientTest.main(ClientTest.java:17)
    

    we should place the hibernate.cfg.xml in src folder..

提交回复
热议问题