English inflections
Table vs Model name
By convention, all tables use a plural form, while corresponding models use singular form of a word.
Examples are:
- Table
COMPUTERS
is mapped to modelComputer
- Table
PEOPLE
is mapped to modelPerson
- etc.
This convention can be overridden with
@Table
annotation.
English inflections
ActiveJDBC is using English inflections to convert singular form of a
model to a plural form of a table. It does include simple cases such as
adding an s
at the end: COMPUTERS
=>
Computer
, as well as English exceptions, such as
PEOPLE
=> Person
, MICE
=>
Mouse
, etc.
If you are interested in how this is done, and what exceptions are supported, you can inspect source code of Inflector
Bootstrapping
At the time of first use of a model after an application start,
ActiveJDBC fetches metadata from a connected database and looks for
tables corresponding to names of models using either English
inflections, or values provided by @Table
annotations
Examples:
Default mapping
will be mapped to a table COMPUTERS
.
Default mapping with English exception
will be mapped to a table OCTOPI
.
Overridden mapping
will be mapped to a table OPERATOR
.
How to comment
The comment section below is to discuss documentation on this page.
If you have an issue, or discover bug, please follow instructions on the Support page