Because it is self-study hibernate, so I first went online to find some hibernate video to see a few days, and then browse the official documents, finally began to do hands-on operation, did not expect to start on the problem, I copy the Hibernate.cfg.xml in the official document to the SRC directory of the project, then modify the database connection information, set up the log4j, JUnit, when I started my first applet hopefully, Only to find that I downloaded hibernate is 4.2.21, while watching the video is Hibernate3 video, the way to create sessionfactory in the video:
Sessionfactory SF = new Annotationconfiguration (). Configure (). Buildsessionfactory ();
The Annotationconfiguration class and The Buildsessionfactory () parameter are empty methods have expired, and then I check the official document after the change:
Sessionfactory SF = new Configuration (). Configure (). Buildsessionfactory (New Standserviceregistrybuilder (). build ());
To create, the result MyEclipse unexpectedly display cannot find Org.hibernate.boot.registry.StandardServiceRegistryBuilder This bag, I immediately was forced, this is a situation, the Official handbook plainly written, unexpectedly did not, then I in Baidu a pass find, what harvest also did not, finally in Hibe RNATE4.2.21 Official API to find a half-day, found that really did not have this package, and then in the version may have problems in the idea of hibernate download two the latest version of the hibernate5.2.10 and hibernate4.3.11, because see hibernate5.2.10 is just out of this year, there may be bugs, so a few more down, Then I did not find the manual manual in the 5.2.10, so I do not understand the latest version, so the use of 4.3.11 version, check manuals and API documentation, found that the Sessionfactory is written in the same way as above, but this time the API has Org.hibernate.boot.regist Ry. Standardserviceregistrybuilder this class, and then happily step by step write, with JUnit test, unexpectedly do not send SQL statement, in Myeclips what error also do not report, this is very embarrassed, I also checked for half a day, can use methods are used, Finally in:
Sessionfactory SF = new Configuration (). Configure (). Buildsessionfactory (New Standserviceregistrybuilder (). build ());
This code added try-catch,myeclips only error, reported the wrong is also strange:
Dialect is not configured, So I checked again several times in the Hibernate.cfg.xml in the configuration, found that there is no problem, no, in this all toss a few hours, and finally are about to give up, or feel that the degree Niang on the absolute have had the problem, there should be an answer, but I have not found it. Finally, Kung Fu is not a conscientious, really let me find a blog, the predecessor said this is the official document error, the official document on the wording did not get hibernate.dialect configuration, the correct wording is:
Finally, that JUnit does not error, I think it should be a bug
Summary: There is pay will have a return, no matter how difficult the problem as long as you try to find the answer, always find! I hope that all the small partners can overcome the difficulties of learning Oh!
Novice small white self-taught hibernate, official documentation error, resulting in the pit Daddy Journey