This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I've decided it was time for me to learn how to use databases with java.
Hibernate seemed to be very useful although I get somewhat stuck when trying to
add the necessary dependencies. I'm trying to follow this tutorial:
which tells me that if I use MyEclipse, I only need to right-click to project to get the hibernate capabilities.
I only have regular eclipse though...
So, I thought using maven I could easily get everything i need, alas i only find archetypes like
hibernate-validator and hibernate-search which doesn't seem to
be what I'm looking for. I also tried adding dependencies manually through maven
(Right-click project -> Maven -> Add Dependency) but I seem to find packages with the same name but different
groupID, leaving me utterly confused as to which for example antlr package to add.
Perhaps leaning eclipse and maven separately is a better idea than to start directly with hibernate?
(Although I would actually want to start with hibernate+wicket).
Yes, I think learning Eclipse and Maven and Hibernate at the same time can be a bit daunting. I think it would be best to first learn a bit about Maven, just running it from the command line, and when you understand that try to use it from an IDE such as Eclipse.
I used to be reluctant to use Maven because I worried that I'd lose track of the dependencies of my project myself, but after using it for a while I think it's very convenient. To use Maven, you setup your project with a standard directory structure, and you create a file named pom.xml that contains information about your project: the project name, version etc. and its dependencies. When you run Maven to build your project, it will automatically download the necessary libraries and compile your code with them. Note that you don't really need to use the specific archetype for a project that uses Hibernate; you can also just generate a simple Java project and add the Hibernate dependency yourself in pom.xml. An archetype is just a template for a project with some specific dependencies etc. already set up, but you can just as well add those dependencies yourself if there's no archetype that already includes them.