CloudTrader is a Java EE application that simulates an online stock trading system. This application enables users to log in, view their portfolio, lookup stock quotes, and buy or sell stock shares. It is built primarily with Java Servlets, JSPs, and JavaBeans. CloudTrader was created by making changes on top of a ten year old DayTrader benchmark application to showcase how you can migrate an existing application to BlueMix and revitalize it with services in Bluemix.
This article will use a BlueMix JPA Sample Application with a db2 or mysql database driven by either EJBs or Servlets. JPA (Java Persistence Architecture API) is a set of APIs that is used for reading and writing data to databases via Java objects. An EJB (Enterprise Java Bean) is a server side Java object that contains business logic with special qualities of service (collaborators) such as transactions and security. We’ll provide some code snippets for EJBs and JPA, and also explain the packaging required for deploying this type of application to BlueMix.
My favorite thing about the BlueMix platform is how quick and easy it is to stand up services and start using them. Let me show you what I mean by outlining a java web application which inserts some data into a DB2 database service. If you’re familiar with creating a servlet, you can do this with me in less than 10 minutes.