We’ve had tremendously positive feedback on my recent article that talked about “Why SQL is neither legacy, nor low-level, nor difficult, nor the wrong place for (business) data logic, but simply awesome” both within the blog’s comment section as well as on reddit .However, one of the sections triggered very controversial feedback. Clearly, not everyone agreed to:Fallacy #5: The database is the wrong place for business logicNow this is really the biggest of all fallacies. Who said that? Some guy from the 90s who had written a book on Object-Oriented Design Patterns? Of course, if you blindly follow random architecture rules, this may apply to you. But then, beware that you’re following 10-20 year-old “legacy” principles by not using SQL (see also
I’ve been testing a ton of frameworks lately – good and otherwise. One of them, the Java micro framework Spark , really amazed me with its simplicity and rapid development capabilities. In this article, we’ll examine an example of Spark’s usefulness by creating a REST API.So, without further ado, let’s see how to store, retrieve, update and delete some information in a PostgreSQL database using jOOQ ORM over a RESTful API in a simple To-do app.
Why SQL Is Neither Legacy, nor Low-Level, nor Difficult, nor the Wrong Place for (Business) Data Logic, but Is Simply Awesome!
The following fallacies are things that I hear all the time.SQL is legacy. Why can’t we work with more modern tech?– Timeless. E.g. by someone who thinks that NoSQL databases are “modern”.SQL is low level, like assembler. Would you prefer to work with assembler or with Java? Similarly, would you prefer to work with SQL or with Hibernate?– Timeless. Someone who thinks that SQL is low-level.In this article, let me clear up some common SQL prejudices and other fallacies. SQL is neither legacy, nor low-level. Here’s why:
jOOQ provides an easy way to automate the process of generating the java classes that represent database tables, records, etc. via thejooq-codegen-mavenplugin. This time we let Maven worry about downloading the required JAR files and generating Java code that lets you build typesafe SQL queries through jOOQ’s fluent API.There are two ways to generate ready to use Java classes with Maven and Vertabelo: Generate jOOQ classes via Vertabelo XML
It often happens that if something is loved, it is also hated with the same power. The idea of object relational mapping fits into this concept perfectly. You will definitely come across many opposite points and fierce discussions as well as unwavering advocates and haters. So if you have ever asked whether to use ORM or not, the answer “it depends” will not be enough.What Is an Object-Relational Mapping (ORM)?Object-relational mapping refers to synchronization between two different representations of data. From one side, there is a relational database, where the data is represented in terms of tuples, grouped into relations, while in application we manipulate objects.
jOOQ and Vertabelo perfectly complement each other in the application development lifecycle. With Vertabelo you can easily design a database structure that saves you from writing DDL code manually, while jOOQ handles the generation of Java classes corresponding to database tables, and allows to construct SQL queries through its fluent API.The integration of Vertabelo and jOOQ has been the subject of several articles published on our blog. Unfortunately, all of them, including
Before writing this article, I talked to a group of software engineers who use Hibernate on a daily basis in their work. Some of them work for small companies (up to 20 developers on site) while others are employed in corporations known world-wide that employ over 100,000 IT professionals. This gave me an insight into how development with Hibernate is organized in different companies.There are several approaches to creating SQL scripts and Hibernate O/R Mapping classes.
What is Gradle?Gradle is an open source build automation system. It can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or indeed anything else. Learn more about what makes Gradle a compelling choice for build automation.One of the exciting moments in a programmer’s life is to leave legacy code behind and have fun with some new, fresh and cool tools. Today, I have just such an opportunity – I’m creating the structure of a new project in Java.
What is jOOQ? jOOQ, which stands for “jOOQ Object Oriented Querying,” is an ORM (object-relational mapping) for Java. With jOOQ you don’t write statements with “SQL-like language”; like Hibernate’s HQL. Instead, you write well designed and intuitive DSL code which, for someone speaking SQL, is obvious and self-explanatory. Read more » Some time ago I announced that the integration of Vertabelo and jOOQ was coming soon. While we’re waiting for an official (stable)
In the Java world, there are many standards. Some of them have grown up from commonly used libraries or frameworks. For example, JPA, which was highly influenced by Hibernate.Standards are good. They eliminate chaos and bad practices. But standards shouldn’t be a kind of Bible for developers. A set of tools used in the project should be chosen consciously, not blindly “because it’s a standard and others use it.” It’s like in the business market, where a monopoly causes a lot more harm than good.
As usual I’ve tried to make the title of my article something catchy. This article will not be about rocket science per se, but instead it will be about a specific usage of relational databases. So, keep reading!Suppose you’re working at some top secret corporation and you’re developing a rocket controller. The rocket controller must:explode when it is near a targetlog time and distance (in case it doesn’t explode)The Java code to achieve this may looks like the following:
Sorry for that tabloid title, but I couldn’t resist. I’m going to show you how to view the database design of other people’s systems. It will work for legacy systems as well. Of course, you may call show tables and describe table in the database console but that’s a very rudimentary way to examine the structure. You’ll miss a bird’s eye view of the design which is crucial to understanding a system as a whole.