You can download the code for this example here:
OnyxDevTools/onyx-database-samples/persisting-data/ ... SavingAnEntityExample.java.
Persisting data is the heart of any database or caching mechanism. Onyx Database can efficiently persist data in a few different ways either by saving an entity, batch saving operations, or cascading through a relationship. This tutorial guides you through how to declare an entity and persist it.
All entities must implement IManagedEntity or extend the abstract ManagedEntity class.
Below illustrates how to use the @Attribute annotation to declare fields as persistable.
The @Identifier can be any the supported Onyx data types:
If the data type is numeric, you can choose to auto increment the identifier using Onyx Database's built-in sequencer.
Generator types include IdentifierGenerator.SEQUENCE or by default IdentifierGenerator.NONE.
You can only specify one attribute as the Identifier.
For more information on Persistence Managers, see: Persistence Manager Factories
Our goal is to bring about change by enabling people to use simple and quality software in order to make sad engineers happy.
Copyright ©2017 Onyx Development Tools, LLC. All rights reserved.