java basics (10)

Handling Exceptions in Web UI

The Issue There is nothing worse than presenting a Java Stacktrace in a WebUI, full of technical Details about your Server environment of the Web App itself: So how can we avoid this? You don't want to share this informations with the users, it would…

Continue reading...

Java and databases use SQL joins

Introduction Let's imagine we have two Tables now, people and addresses. We want to find out how many people live at the same address. This is our current Java and SQL approach: repository/PeopleRepository.java @Override @SQL(value = FIND_BY_ID_SQL, operationType = CrudOperation.FIND_BY_ID) @SQL(value = FIND_ALL_SQL, operationType =…

Continue reading...

Java basics: Dates and Time

Local date Now Let's start with the basics, we just want to represent the date today and print that local date now: public class TimeTest { public static void main(String[] args) { LocalDate now = LocalDate.now(); System.out.println(now); } } output: 2022-08-29 Process finished with exit…

Continue reading...

Java basics: Optionals

What are Optionals? For the the number one use case for them has to do with null values. So whenever we're dealing with objects in Java, we store references to objects in variables. And those variables may or may not actually be pointing back to…

Continue reading...

Java basics: Generics

What are Generics? What if we could write a single sort method that sort the elements in an Integer array, a String array, or an array of any type that supports ordering? Java Generics enable programmers to specify, with a single method declaration, a set…

Continue reading...