Please advise me a project where I can see how to use Spring MVC and Hibernate together in the right way. I'm new to these frameworks.
Appfuse has a Maven archetype for this stack. Strongly suggest you have a peak. Alternatively the book Spring in Action was a great resource for me in learning spring and hibernate/spring interaction - use Annotation driven transaction management as well and you have a really great start.
see here: http://appfuse.org/display/APF/Using+Spring+MVC appfuse-basic-spring is the basic project archetype.
Using maven modules is a better practice. ie) appfuse-modular-spring
better answer:
If I was going to recommend HOW to learn these technologies, I would say learn how to build a hibernate/maven/xml project first by following this: http://www.mkyong.com/hibernate/quick-start-maven-hibernate-mysql-example/
Then learn how to use spring for dependency injection with maven/hibernate and xml: http://www.mkyong.com/spring/maven-spring-hibernate-mysql-example/ Take special note of layering of the bo/dao pattern and how you use interfaces but wire in implementations with spring di - this is crucial for writing quality code
Next check hibernate annotations and annotation driven transactions: http://www.springbyexample.org/examples/hibernate-transaction-annotation-config.html http://www.springbyexample.org/examples/hibernate-transaction-annotation-config-code-example.html http://www.mkyong.com/hibernate/maven-hibernate-annonation-mysql-example/
Finally, you can learn your mvc framework of choice. I actually recommend struts2 but it won't matter much. use spring DI by implementing interfaces and wiring implementations at runtime for you actions/controller. If you don't understand this how, you will after the hibernate/spring tutorials. Spring in action will be a good reference to keep on your desk but will take a few weeks to digest as you learn. Good luck! You can do it - I did and am now working as a java dev!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With