views:

858

answers:

9

I am working on medium sized web application 4-5 tabs, user login for about 100k users. We are completing redesigning the application from scratch and using spring and hibernate, connected to MySQL.

Did you experience major issues and what where did Spring benefit your application.

+1  A: 

Obviously there are a million ways to build an application like this, both in the java frameworks world and with things like Rails or Django.

A big selling point for me is that both spring and hibernate have become defacto standards in the java world, so they definitely qualify as "things you ought to know" ( I get asked on every job interview). Spring more so than Hibernate.

Getting the value of spring took a few spring-enabled apps before it made sense for me. It enforces independant code modules and a certain style of component design that facilitates testing. I'd suggest you just go with it and get the sense of the value of it from use.

I have mixed feelings about Hibernate, though it's important to use some kind of db layer, so you may as well.

Also see this question.

Steve B.
+8  A: 

No major issues. Spring was particularly of benefit for:

  • Making all the configuration plumbing consistent and straightforward
  • Dependency Injection to support better factoring of code
  • Declarative "Open Session In View" functionality for Hibernate
  • Declarative Transaction Demarcation
  • The Acegi (now Spring Security) project made it easy to integrate a custom security model
  • The Spring data access support removes the need for a lot of boilerplate from any JDBC access - maybe not such a boost for Hibernate usage, but we had a mix of both. It also allows you to use JDBC & Hibernate together fairly seamlessly
alasdairg
+4  A: 

In addition to what has been said so far, I would focus on newer style annotations for both Spring (e.g. @Controller) and Hibernate (e.g. @Entity). It will further reduce your codebase leaving you with less code to maintain. On the downside, there is a pretty significant learning curve, but ultimately the lesson I learn time and again is that the benefits of Spring + Hibernate far outweigh the (learning curve) costs. You simply have to write a lot less code letting you focus on the business.

Julien Chastang
+3  A: 

+1 Spring+hibernate......

100k users is not mid-size....that is huge.

With spring, you can force coder to code to interfaces and this increase testability. This is the benefit i don't hear people talk a lot about.

take a look memcached to cached data memcached.....

l_39217_l
100K users at the same time or total, that is the question ;)
krosenvold
you are correct!!
l_39217_l
+2  A: 

As Julien Chastang said, you need to factor in the learning curve in your estimations if this is your first project. We failed to do that on our first try and ended up having to adjust a lot of our planning because several aspects of Hibernate were "hard" (eg. took some time) to figure out.

One specific piece of advice I can give based on an issue we came across is: if you need to write complex SQL, and you don't want to spend the time figuring out how to get such queries working within HQL or other offerings within Hibernate, get it working first in vanilla SQL and then go back later and patch it back into Hibernate.

Rahul
+1  A: 

There are some situations with Hibernate where creating a particular object to relational mapping, or writing a particular HQL query, is very difficult. However, you're going to run into 1 thing like that out of 10, and the more normalized your database the better off you will be. It's worth it.

Any new Java web project should use Spring MVC (2.5+ with Annotations) and Hibernate.

bpapa
+1  A: 

There is a large understanding overhead to hibernate and spring. I'd only suggest it if you have plenty of time or an experienced java/spring/hibernate developer to call on. With a spring project once you get it going you can basically ignore the spring parts of it and concentrate on page and logic design. Hibernate is not that difficult. HQL is a harder ask. Most of my time is spent at the bean and JSF level. Comparing that layer of my project to some mates who are messing about in JSP, I'm glad to be in the ease of JSF. I easily swapped to Oracle from the initial implementation in MySQL, so that proves that Hibernate handles abstraction nicely.

Martlark
+3  A: 

techincally speaking I have, I've deployed commercial applications with numbers from the thousands to a few hundreds of thousands using spring, hibernate and both.

From the management perspective in one case, I had a team that were good technologists, so they managed to rewrite an app with spring and hibernate but... they went crazy with the interfaces (each new object to the model needed 16 interfaces), abused the AOP so transactions and logging were almost impossible to follow and stack traces were meaningless, used tools to map the hibernate files without fully understanding what was being done (in some cases joining 4 tables for what could've been a simple entity, and a variety of issues that made the resulting application much harder to enhance, debug, fix, even setup the developer's environment....)

my 2c

webclimber
A: 

in addition to what has been said so far, i strongly suggest the book: Spring Recipes - Problem Solution Approach (Amazon), in combination with the very good online documentation you should be ready to conquer the world ;-)

Michael Lange