title: Complex data-driven web application in Java - Decision on technologies
body: <p>Dear Stack Overflow Community,</p>
  
  <p>I am a Java programmer in front of a task of building a complex, data-driven, web application (SaaS) and I'm searching for technologies to use. I have already made some decisions and I believe I'm proficient enough to build the appliaction using just the technologies I have decided for (I'm definitely not saying it would be perfect, just that it would be working). However, I'd like to make my task easier and that's why I need your help.</p>
  
  <p><strong>Brief description of the project</strong></p>
  
  <p><em><strong>Back-end</em></strong></p>
  
  <p>The application will be heavily <em>data-driven</em>, meaning that everything will be stored in a self-descripting database. This means the database itself will be entirely described with metadata and the application will not know what data it reads and writes. There won't probably be any regular entities (in terms of JPA @Entity) because the application won't know the structure of the data; it will obtain it from the metadata. Only the metadata will have a pre-determined structure. To put it simply, the metadata is the alpha-omega of the application because it will tell the application WHEN and WHAT to display and HOW to display it.</p>
  
  <p>The application will probably utilize stored procedures to perform some low-level tasks on the data, such as automatical auditing, logging and translating to user's language, thus most likely eliminating any possibility to use ORM frameworks because there won't be just simple CRUD operations. Therefore, JDBC seems like my only option (doesn't it?).</p>
  
  <p><em><strong>Front-end</em></strong></p>
  
  <p>The UI will be "dumb" in terms that it will not know what data it is displaying (to some extent, of course). It will just know how to display it based on the metadata which it will obtain from the database. All UI controls (like menu items, buttons, etc) will be created based on current application's state and the UI will NOT know what the controls do. This means that clicking a menu item or a button will just send an identifier of associated action to the back-end and the server will decide what to do.</p>
  
  <p><strong>My goals</strong></p>
  
  <p>My main goal is to have the application as lightweight as possible with as least dependencies as possible. Because the application will be very complex, I'd like to avoid any heavy framework(s) because there is a very high probability that I'd need to customize a lot of its functionality.</p>
  
  <p><strong>What I have already decided for</strong></p>
  
  <p>Please object to the following decisions only if you think they're absolutely non-viable for my application, as I have already implemented some core functionality using these technologies:</p>
  
  <ul>
  <li><p><strong>Servlets</strong> on Tomcat, <strong>Guice DI</strong>, AOP (<strong>AspectJ</strong>)
  <br />I believe all of these technologies are lightweight enough and I don't need to learn J2EE.</p></li>
  <li><p><strong>GWT</strong> with <strong>GIN</strong>-jection on the front-end
  <br />Seems like the best option for me because I'm very familiar with Java and Swing and don't want to write any Javascript, PHP or learn a new language. GIN is a little brother of Guice and I will be using the same syntax and principles on both the client and server.</p></li>
  <li><p><strong>MSSQL</strong> RDBMS
  <br />This is actually a requirement from company management as I'd much rather like to go with an open-source solution. Too bad for me..</p></li>
  <li><p><strong>Maven 2</strong>
  <br />I think no-one can object to this :)</p></li>
  </ul>
  
  <p><strong>What I need help with</strong></p>
  
  <ul>
  <li><p><strong>DB communication</strong>
  <br />I think that ORM is ruled out (is it?) so I need to use JDBC. Do you think Spring JDBC is lightweight and flexible enough for my use? I would often need to "blindly" read data from database, mapping it to some generic entity (because I won't assume any pre-determined structure), and then send the data using some generic DTO to the client along with the metadata telling it what data it is and how to display it. Or do you know any alternatives? Or should I do this myself?</p></li>
  <li><p><strong>Client/Server communication</strong>
  <br />GWT and its GWT-RPC mechanism seems not very suited for sending the generic data I need. Although I'm convinced that it's doable using GWT-RPC, are there any alternatives? But I definitely want to use GWT.</p></li>
  <li><p><strong>Security</strong>
  <br />Do you know any security libraries / frameworks that would help me? I'm aware of the existence of Spring-security; do you think it's flexible enough for my use or I'd be better off implementing that myself? Also, is Spring's IoC an integral part of the Spring framework, or would I be able to continue to use Guice?</p></li>
  <li><p><strong>Anything else</strong> that you think might be useful?</p></li>
  </ul>
  
  <p>I really appreciate any advice and suggestions because I wouldn't dare to try to make such decisions myself. Please ask me if you need more information.</p>
  
  <p>Thank you in advance!
  eQui</p>