Posty

Wyświetlanie postów z sierpień, 2019

Java EE 8 & Wildfly 17 & RestEasy setup

Introduction Java SE/EE for quite a long time was slow. Not in performace, but in releasing new features. Since that was not a good thing in todays fast and modern world, when almost every week new hot thing comes up, it has had to change. And fortunatelly - it does. Now releases are much, much more frequent. And with Eclipse Foundation taking care of Java (or should I say Jakarta) the future looks bright. But Java SE/EE is nothing more than just a set of specifications. You cannot do a thing with it. You need application server. And this post is all about setting up a basic project with Wildfly, the Redhat's free, widely used and highly customizable application server. Since it is easy now to miss out on new stuff, I am going to user newest Wildfly, which is 17 (Java EE 8 support) with JDK 12 to create simple service. Whole code can be found right here:  https://github.com/KKucharczyk/javaee8-bootstrap Requirements To setup simple application, couple of things are requ

Messing with PostgreSQL: b-tree indexes, likes and operator classes

I can do a lot with JPA. Working with database is not a hard thing in Java environment. Java EE has a pretty easy standard when it comes to working with data, Spring makes configuration even easier and Hibernate takes care of almost every problem with already created and tested solutions. Although lately I started to peek at the possible optimization. Since I have came to as little Entity Manager calls as possible, there is not much to do in the code. So I decided it is, finally, time to dive deeper into databases and their magic world of indexes, analyzing, likes, trigrams, etc. I am used to work with PostgreSQL RDMS, so this post will be mostly in its dialect. What I already knew? If you want your database to work faster - index its appopriate fields. Basic knowledge. But... why? How does the indexing work? Those are my new questions. And to get some answers, since lately I started to work with Spring Boot (literally just searched to see, how correctly write it :o ) and Sprin

Optional finallyLearned()

Optional<Learn> finallyLearned! Yes, this is a post about my long journey with Optionals. Optionals have been around for quite a long time. They came with Java 8, what makes  them almost as long in the industry as... I am, actually, since the first thing I had to do in my first job was learning those strange Stream thingy. Even though so much time passed, I never really saw a purpose for Optionals. That is of course, because I couldn't use them the way intended. At first I wanted to use them exactly like old if-else statements, so: Ugly, isn't it? Considering myself being so edgy, so robust, so futuristic was dimmed by simple thought - why not use basic if-else? What were those silly Optionals thinking? Isn't it reinventing the wheel? Also not being able to chain isPresent() method with orElse() was a total misunderstanding for me. "Of course I would like to cover all possibilities, why can't I with easy syntax?" - I thought. Suddenly, with Java