Persistence Using Layers

Managing the persistent storage for an application is another tremendous source of code that can bog down application development. Depending on what you need, some light-weight way to embed SQL in your code, or some object/relational mapping technique, or your NoSQL or JSON oriented database using the API of choice are your best options. You can use all of these approaches with StrataCode today.

StrataCode has JPA layers for generating a default persistence.xml file from annotations. Another nice practice is to break your domain models up into layers based on logical groupings of properties, maybe considering what groups might be stored separately. For example, in a User object you might separate out login properties, profile properties, and orderHistory as three separate groups. This would make it easier to code-generate more flexible domain models in the future.

There are several planned features to leverage layers with persistence: