Entity model

Object-relational mapping

Object-relational mapping (ORM) is a widely used concept in modern IT systems. The main task of ORM systems is to bridge the gap between relational data storage schemas and the object-oriented world. Developers can choose from a wide range of object-relational mapping systems when developing applications (Hibernate, EclipseLink, JOOQ etc.).

 

Then what makes JUDO's ORM system unique? 

Our object-oriented data definition and query language helps you design your applications faster than ever before. JUDO is a new generation text-based modeling environment that covers the entire architecture of applications, from the data model to user interactions.

 

There is no need to learn new, complicated database languages. JUDO's basic functionality is straightforward for anyone who has encountered object-oriented concepts. It provides simple data definition with comprehensive, type-safe query functions.

Example

Here is an example of how easy it is to create or understand the data model of an application.


model shop;
import judo::types;
entity Customer {
	identifier required String email;
	field required String name;
	relation Order[] orders;
}
entity Order {
	field OrderItem[] items;
}
entity OrderItem {
	relation required Product product;
	field required Integer amount;
}
entity Product {
	field required String name;
	field required Integer price;
}

copy to clipboard

As you can see, we simply define the data model in a Java-like language. Once the data model is ready, the JUDO compiler produces the necessary database schemas in a Liquibase changeset. What's more, we can immediately use the type-safe Java API and take advantage of the powerful but straightforward CRUD capabilities.

The generated Java code can be run, tested, and integrated into projects.

In addition to traditional ORM data definitions, we can also use derived data and calculations in our model. No post-processing is required, we can simply query the derived members of the data model.


entity Person {
	field required Name firstName;
	field required Name lastName;
	derived String fullName => self.firstName + " " + self.lastName;
}
copy to clipboard

In the generated Java code, there will be a simple attribute on the Person object, which will contain the computed value after the query.

Although this is a very simple example, our specification language (JSL) offers a lot more possibilities. The advanced functions are well integrated with the basics while they are efficient and easy to understand. For example, you can generate data diagrams that you can insert into your technical documentation. We encourage you to check out our detailed documentation.

And if that's not enough, source code editing is supported by syntax coloring, code completion, and instant diagramming on the most popular IDE platforms (Eclipse, VS Code, IntelliJIDEA).

More about JUDO Entity Model

Check out our GitHub Repository!