Looking for *working* Hibernate examples [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI have been scouring the intertubes for working somewhat recent Hibernate examples. I understand it well on a conceptual level, but I'm having trouble throwing together a "hello world" program, because every one I find doesn't build for me. I should be able to adapt to different entity relationships after that, but I would settle for an example with just one or two entities, with all files where they need to be, without depending on a blac-box-build IDE like Eclipse (I like ant, and am learning Maven), ideally configured for MySQL.
- The tutorial from the jboss site wouldn't build for me (sorry, I got frustrated and rm -r'ed the directory, but if you tell me it does build, I'll try again).
- The tutorial that comes with Hibernate didn't even work, and isn't even consistent with its own documentation. The HTML documentation that comes with the "web" project shows different file contents than the files that came with it. And when I got it all compiled with mvn compile a开发者_如何学编程nd tried to run it, it couldn't find the EventManager class. It even contains the wrong command to start the hsqldb.
- The tutorial at http://www.allapplabs.com/hibernate/hibernate_comlete_example.htm contain an ant script that can't find some of the jar files it comes with.
And so on. I just got laid off, so while I see references to some good books, I can't dump $50 on one right now. I appreciate any pointers. Thanks.
https://www.hibernate.org/400.html is the source code page for Java Persistence/ Hibernate in Action books. It has a 'Hello, World' example. There is also a sample chapter that walks you through the example.
Look at this article, a detailed step by step example
look into appfuse lite, choose a hibernate configuration and start poking around. A fully functional web app will help you learn whatever framework you want.
Maybe look at the hibernate / JPA tutorial as part of the netbeans documentation. These tend to work well with examples from the IDE.
Karl
精彩评论