This is the second in my blog series on using an Db2 backend with XPages. I will go over the application architecture, and do my best to explain why we did things the way we did.
Working for a very large financial company, they are extremely concerned with protecting the security of their customers. This is a good thing of course, especially considering some of the high profile breaches in recent years.
To protect themselves, they have a mindset of following security standards in developing applications, even internal applications like this one. Standards are fine and good, but in the fast moving world of Web Application Development it is difficult to standardize on anything, because two years later the winds have changed. As a developer, I am very concerned with keeping up with the latest trends, and taking advantage of the collective knowledge of my blogging peers. This can lead to some debate when the standards don't mesh with recent trends or best practices. As my coworkers could attest, I am always up for defending my position, but ultimately, you have to do what your employer says to do because hey, they are paying you.
With that background being said, I want to explain that what is going to be explained in this blog series isn't intended to demonstrate the best way to connect to relational databases. This series is going to cover the way we DID do it. I make no claims that this is the best, easiest or fastest way, but this is a way that did work and there is a lot to be said for that. There are lessons that can be learned from what we did, or maybe even lessons on what not to do.
From the start, I designed the application to follow a Model-View-Controller style architecture. For the most part I felt we were able to accomplish this goal, especially in keeping code segregated. Speaking of M-V-C, I found these slides from Ulrich Krause at Engage 2015 to be a very excellent overview of M-V-C in XPages. Wish I could have seen the session.
|High Level Architecture|
Some key points not readily apparent from this high level chart.
- The UI elements are not directly bound to DB2 data via the relational controls, they are bound to either viewScope or managed bean fields and changed using java methods in the controller layer.
- There is no Object Relational Mapping framework in place (ie: Hibernate)
- As much as possible business logic is in java, but all DB2 access is in java.
- The java methods in the controller layer contain actual SQL statements to interact with DB2.
- We are using the extention library relational controls, but do not use the <xe:jdbcQuery> and <xe:jdbc:jdbcRowSet> (since all access is via java).