Using The Active Record Pattern With SQLite and C++
The Active Record Pattern is a popular design pattern for accessing data stored in a relational database. This pattern can be used to greatly simplify the use of SQLite in C++ applications. The concept of the Active Record Pattern is to use an object to wrap a row of data in the database. For an example, I will use the Section table from DocUMentDS, my recently released Desktop Document Manage System. Figure 1 show the UML for DocUMentDS.
The Section table has the following fields
- id (int)
- name (varchar)
- user_id (int) (foreign key)
One of the main concepts of the Active Record Pattern is the containment of all data access methods and business logic inside the corresponding class. For example, Figure 2 show the simplified generic UML of the actual Section class:
Notice that the class contains accessors and mutator for the class attributes, but also contains business methods save, update, remove and finders for this class. The Active Record Pattern allows us to simplify data access by placing all the needed methods inside the Section class. Therefore, the Section object contains everything we need to create, access or modify a Section objects.
This shows the code for section.h:
number of view: 2625 Posted by ken under Sqlite, c++ | Permalink | 1 Comment »Spring MVC Tutorial Part 1
I start from the very beginning of building a Spring MVC application and give step by step instructions on how to build and deploy a Spring MVC application. All code and configuration files are explained to give you an understanding of how the application functions.
This tutorial contains the following sections:
- What you need
- Building your project
- Writing the required code
- Deploying the application
- Testing the application
What you will need
1. Java 1.5 or greater SDK
- Download the latest full Java SE SDK from www.java.sun.com
- Follow the installation instructions provided with the download.
2. NetBeans 6.8
- Download NetBeans 6.8
- Follow the installation instructions provided with the download.
3. Tomcat 6 or later
- Download the latest Tomcat at http://tomcat.apache.org
- Placed the unzipped apache-tomcat-xxxx folder in the directory of you choice.
- Follow the NewBeans instructions on how to install application servers and install Tomcat.


