JavaRush /Java Blog /Random EN /Hibernate for dummies. Review of the book "Java Persisten...

Hibernate for dummies. Review of the book "Java Persistence API and Hibernate"

Published in the Random EN group
It's no secret that most technical literature in the world is written in English. And Java development is no exception here - a significant part of the materials is either not available in Russian at all, or is translated in such a way that it is better to learn using Google translate. It will be all the more joyful for the entire Russian-speaking Java community that the most famous book on this topic, “Java Persistence API with Hibernate,” was translated into Russian about six months ago.
Hibernate for dummies.  Book Review
If you want to become a Java developer - one day you will have to learn to use Hibernate . Of course, there are exceptions to any rule, it all depends on the specific project, etc. But if you look at your career in the long term, in real work you will certainly come across this library. Without exaggeration, the book presented in the article can be called fundamental: it is the main guide to Hibernate among everything that has been written about this technology. This is explained quite easily, because among its authors are the founder of the Hibernate project, Gavin King, and Christian Bauer, a member of the Hibarnate development team. For me personally, this immediately acted as a kind of guarantor of quality: who is good at rummaging around in technology if not its creators :) On the other hand, it is not always the case that a good specialist or even the creator of a technology can write an easy-to-understand educational book. Whatever one may say, personal skill and the ability to teach have almost no correlation with each other. An example is the legendary “The Art of Programming” by Knuth or the “C++ Programming Language” from its creator Bjarne Stroustrup. And if it is impossible to deny the highest level of knowledge of the authors, then their books are, to put it mildly, difficult to read. Fortunately, the creators of Hibernate and the authors of this book have created a product that is quite understandable from the point of view of a novice programmer. Who is this book for: Like most similar books, the abstract says that it is “for everyone,” including those who learn Hibernate from scratch. In fact, it is still better to have some preliminary preparation in the form of related technologies. Below is a list of things that will make your life much easier when reading this book.
  1. If you don't know what relational databases are, you can't create a table or write even a simple SELECT query, etc. - it’s better to start with this. By the way, this will be useful for those who plan to participate in the JavaRush internship. Start with SQL, Hibernate later. Fortunately, an excellent Head-First was written in SQL (for my taste, one of the best HeadFirsts in the entire series).

  2. JDBC . The technology is far from new, but many experienced developers still prefer it to Hibernate.

  3. After that, it would be nice to read (at least superficially) about what an ORM is and why it is needed . After all, Hibernate is first and foremost an ORM, that is, a thing that turns Java objects into database records (and vice versa).

    For example, you have a User class, an Auto class, and each User has a list of its cars List<Auto> autos.

    How to record all this in a database so that the connections between users and their machines are preserved? After all, there is only one user, but he can have many machines:/ How can we automatically delete all the user’s machines from the database if we deleted the user himself (that is, prohibit the database from storing “orphaned” machines)? Hibernate just knows how :)

  4. In addition, Java has its own implementation of the ORM model - Java Persistence API , or simply JPA. It is also discussed in the book, but it is better to skim through it first. You don’t need to read tons of literature on the topic: if you know what a POJO, Entity is, and what requirements apply to Entity, it will be quite good.

  5. If you're not familiar with the XML format , it's time to become familiar with it before reading this book. Very often, Hibernate (as well as Spring) config files are written in XML format, and if it terrifies you, it will be more difficult to read the book.

  6. If you are familiar with design patterns (at least from JavaRush tasks), then you can read about the DAO pattern and why it is needed. DAO is very easy to implement using Hibernate. By the way, internship participants will create “daos” when writing a test task (and on the project itself, too). And in real work, creating them is a routine task, so it won’t be superfluous.

Preliminary acquaintance with all of the above will greatly simplify your studies (and in work, this is, as they say, a must-have). In conclusion - a little IMHO about the advantages and disadvantages of the book. Pros:
  • Quite a good translation from English . I don’t think it’s worth writing separately about the importance of this point. Of course, the original will always be better, and if you know English at a sufficient level, it is better to read it. However, for those who are not yet comfortable with English, but do not want to stop studying because of this, this is an excellent option.

  • Very wide coverage of topics . Almost all the “insides” of the library are described. About something in great detail, about something more sparingly. But overall, the coverage turned out to be quite decent.

  • Simple and understandable language .

Of the minuses, I can only highlight examples. In my opinion, they could be simpler and more concise. And given the volume of new information that has fallen on the reader, it may be difficult for a beginner to even just compile and make the whole thing work. Not to mention understanding what is happening in the code. I can personally recommend that you don’t bother cloning examples from GitHub and type them yourself. And you’ll get the hang of it, and your understanding will be much better. Better yet, after reading the next chapter, come up with and implement some task yourself. This will be much more productive, even if the task is very simple. Is it worth buying the book? Definitely yes. Moreover, its paper circulation is only 200 copies :) Based on the materials of this book, I quite easily wrote my first article on Habrahabr. And the JavaRush administration, in my opinion, should definitely add it to the list of prizes for their competition :) Thank you for your attention, and good luck in your studies!
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION