Re-branding

logo

SysHex was the nickname chosen by me more than fifteen years ago, when I started university. This blog was created under that name mainly because I was the main contributor to it. Some time has passed and basically all posts here were created and contributed in some way by me and all, my friends and colleagues over at JBay Solutions.

So, we are re-branding the blog! JBay Solutions is the name of the company we have created a bit over four years ago. We are focused on Java development, specially the JavaEE side of it. We have also started Android development over one and a half years ago. We are based in Lisbon, Portugal.

We’ll keep on doing what we do, but it just seemed to make more sense to have this place under JBay Solutions instead of my nickname. That’s about it!

JPA 2 Tutorial – Many To Many with Self

selfWe have just covered the subject of Many-To-Many relationships, which is a fun topic for the hole family! Now there are some particular cases on the Many-to-many front which are not particularly hard, but can lead to a bit of confusion. One of those particular cases is the M2M with same table.

A reader asked : “How would one create manyToMany relationship with the same entity. Entity user can have friends (user), and can be friend to other users. With note that junction table has to have some additional columns besides user keys. How can that be achieved?”  (Thanks Felix for the feedback and question!)

Read more of this post

JPA 2 Tutorial – Relationships – Many To Many

So, we have already dabbled into Relationships in JPA, in particular One-To-Many and Many-To-One. It is now time to give a look into Many-To-Many, which is very similar to One-To-Many Relationships. So at this point you should have read the previous two tutorials on JPA 2, but if for some reason you don’t know what I’m talking about, give a look at these two links, they will help quite a bit:

Read more of this post

Java Threading and Concurrency Introduction

Multi Threading is one of the most interesting subjects when developing applications, be them in Java or any other Language: The ability to have ones software performing multiple tasks at the same time, maybe handling multiple requests from users, parallel processing things… wicked stuff really!

On the other hand… when things go wrong with multi threading, they go wrong really fast, they go wrong all over the place, it is hard to debug (specially if threads “share” stuff) and you get the usual comment: “I just don’t get it why this is doing this”. Multi Threading is not without challenges!

In this Tutorial we’ll be going through a bit of theory regarding threads and the Java memory model, but I’ll try to make it as interesting as I can with examples and demonstration of concepts. We’ll see how stuff can go wrong, how to avoid those situations, and we’ll play with threads just to see them working! A more advanced tutorial will follow(at some point) in which I’ll discuss more advanced parts of Threads and Concurrency.

Read more of this post

JPA 2 Tutorial – Relationships – One To Many

Following from the previous tutorial we now dive into move interesting and complex parts of JPA 2: Relationships! In this tutorial we’ll be focusing on One-to-Many relationships (mainly Bidirectional), looking into their particularities (specially related to the Cascading of operations), we’ll create a JUnit Test class for testing the Relationship, look at what actual SQL queries that are performed, learn by example and also some more interesting theory that is related to all of this. Read more of this post

Getting Started with JPA 2 Tutorial

So, one of the most common comments I get to hear while at work almost every week regarding JPA is : “Oh I Just hate JPA!” . I never really had much of a problem with it, obviously sometimes with JPA something just doesn’t want to work for some strange reason and the Logs don’t really help finding the problem but most of the days everything works fine.

At some point I decided that I would write a few tutorials on JPA. Some time has passed since and now I’m actually doing it. Use the comments section for corrections if you find any problems or errors, or if you would just like to leave a kind word!

Read more of this post