Skip to content

How to create a model class by yourself

Häbu edited this page Nov 13, 2017 · 8 revisions

Creating a model-class

The Model (DataObject)

Define a Data-Class in style of a POJO (Plain old Java-Object). The only Methods to write into this class are getters and setters of the Properties

The Model-Controller

In the Model-Controller the logic is stored and here happens the magic ;). The Model-Controller must extend the Parent-Controller, because the Parent-Controller holds the executor, which handels the interaction with the database. To interact with the database you just need to call the method 'executeQuery' with the given executor and you will get a result with Type you gave as parameter.

The Queries

In a Query-Class you only define constants with Prepared-Statements.

The DataObjectMapper

In the DataObjectMapper you must map the results of the queries of your object to the right properties in an DataObject.