-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Infinitum ORM allows developers to spend more time focusing on their problem domain and core business logic and less time on innate data-access and boilerplate code. It embraces object-oriented principles such as polymorphism, inheritance, and association while maintaining a great deal of flexibility. The ORM allows developers to specify what is transient or persistent at a class- and field-level, and it is configurable using either XML mappings or Java annotations. The Infinitum ORM also provides a criteria API for constructing database queries, allowing developers to query on objects rather than tables — no SQL necessary.
The framework also offers an extensible REST ORM implementation, granting developers an effortless way to communicate with their own RESTful web services using domain objects.
This user guide is designed to provide explanation for some of the various ORM features and, perhaps more important, how to use them. For information on using other module features, see their respective wikis.
For information on what's in progress and what's planned for Infinitum, check out the Road Map.
The Infinitum ORM provides an object-oriented approach to application data persistence while factoring out the underlying datastore representation. It allows for the persistence of POJOs (Plain Old Java Objects) and offers an API for constructing and executing SQL-less database queries and object-oriented REST calls. The ORM's overall goal is to allow developers to spend more time focusing on their problem domain and core business logic and less time on underlying data-access and boilerplate code by providing a transparent persistence layer.
-
Resources
- infinitum.cfg.xml: XML framework configuration file.
-
Components
-
InfinitumOrmContext: stores ORM configuration data read from
infinitum.cfg.xml
and acts as aSession
factory.
-
InfinitumOrmContext: stores ORM configuration data read from
The ORM's user-facing API is actually relatively small. All data transactions are made through a single Session
interface. The Session
is the primary persistence service and is used to construct and subsequently execute queries.
-
Components
- Session: Infinitum persistence service.
- Criteria: object-oriented database queries.
-
Criterion:
Criteria
query restrictions. -
Conditions: provides static factory methods for creating
Criterion
. - TypeAdapter: facilitates the mapping of datastore values to Java data types and vice versa.
- JsonDeserializer: tells Infinitum how to deserialize JSON responses into domain model instances.
- XmlDeserializer: tells Infinitum how to deserialize XML responses into domain model instances.
The Infinitum ORM can be provided with metadata for an application's domain model in order to configure some of its behavior. For example, a class can be marked transient or persistent, a model can be mapped to a specific table, or a field can be mapped to a specific column. Of course, following the principle of convention-over-configuration, this metadata is not required as Infinitum can infer it itself.
Metadata can come in two forms: XML map files and annotations. XML map files provide mapping information for domain classes while annotations provide the same information inline within the class.
-
Annotations
- Entity: indicates the persistence state of a model.
- Table: indicates the name of a table an entity is mapped to.
- Persistence: indicates the persistence state of a field.
- Column: indicates the name of a column a field is mapped to.
- PrimaryKey: indicates if a field is a primary key.
- Unique: indicates that the field value must be unique to the table when being persisted to the database.
- NotNull: indicates that the field may not contain a null value when being persisted to the database.
- Rest: indicates the name of an endpoint name-value field an entity field is mapped to for a RESTful web service.
- ManyToMany: indicates that the annotated field represents a many-to-many relationship with another persistent class.
- ManyToOne: indicates that the annotated field represents a many-to-one relationship with another persistent class.
- OneToMany: indicates that the annotated field represents a one-to-many relationship with another persistent class.
- OneToOne: indicates that the annotated field represents a one-to-one relationship with another persistent class.
-
Resources
- imf.xml: provides mapping information for a specific domain class.