Skip to content

How into in 5 min

IrlHenry edited this page May 23, 2017 · 10 revisions

Create main configuration class




Create some entity



Entities requires public empty constructor and (optional, but good to, to avoid bugs) getters and setters. Entities could contains other Entities (then u must annotate that as @Table to create a table and @Relation to create relations between them. All fields that must be saved in database must be annotated as @Column, at least one field must be annotated as @Id which means it's primary key. Column could have default values if you initialize field in place. Also Entity could contains arrays and lists, but you must annotate them as @Array, arrays has fixed size, by default it's 10, but you can set size in annotation argument. If you decide to use List's, pay attention that in declaration field of list can only be type of List<> or ArrayList<>.




Set up configuration



In configuration class, you declare tables (using @Table annotation) which must be created and other configuration classes. @Drop annotation, means that table which will contains your entity, will be deleted each time you will update database version or restart application.

Clone this wiki locally