File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven Archetypes, eclipse and hibernate

 
Adam Johansson
Greenhorn
Posts: 3
Eclipse IDE Linux Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

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:

http://www.laliluna.de/articles/first-hibernate-example-tutorial.html

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).
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Welcome to the Ranch!

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.

See this Maven in 5 minutes tutorial for a hands-on introduction.

If you don't have MyEclipse, you can get the m2eclipse plug-in for regular Eclipse to get Maven support in Eclipse.
 
Adam Johansson
Greenhorn
Posts: 3
Eclipse IDE Linux Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jesper!

I will follow your advice!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic