Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions


and many more ....



Neo4j: The BBC Champions League graph

A couple of weekends ago I started scraping the BBC live text feed of the Bayern Munich/Barcelona match, initially starting out with just the fouls and building the foul graph. I’ve spent a bit more time on it since then and have managed to model several other events as well including attempts, goals, cards and free kicks. I started doing ...

Read More »

We’re Taking Bets: This Annotation Will Soon Show up in the JDK

This recent Stack Overflow question by Yahor has intrigued me: How to ensure at Java 8 compile time that a method signature “implements” a functional interface. It’s a very good question. Let’s assume the following nominal type: @FunctionalInterface interface LongHasher { int hash(long x); } The type imposes a crystal clear contract. Implementors must provide a single method named hash() ...

Read More »

Java EE Deployment Scenarios for Docker Containers

I’ve been posting some content around Docker since a while and I like to play around with containers in general. You can find some more information about how to run Docker-Machine on Windows and also showed you how to use the Docker 1.6 client. One of the first blog posts was a compilation of all kinds of resources around Java ...

Read More »

Is Getter DI A Good Idea?

Sometimes, you may hear about dependency injection done via a getter method, which subclasses override or mock frameworks fake for testing. It allows the class to have a set dependency that is actually hard coded, but can be “injected” if need be. I’ve written before about the idea of what I will call “firm-coded” dependencies from now on. I didn’t ...

Read More »


编者按:Hibernate ORM(简称Hibernate)是一个对象-关系映射框架,用于将面向对象的域模型转换为传统的关系数据库。Hibernate通过将直接的持久性相关的数据库访问替换掉,而高级对象处理功能来替换,解决了对象-关系间不匹配的问题。 Hibernate是最流程的Java框架之一。为此,我们在Java Code Geeks提供了大量的教程,点击这里查看它们。 现在,我们想要创建一个独立的、具有参考性的文章,来提供一个关于如何使用Hibernate的框架,并且帮助你快速开启你的Hibernate应用开发。开始享受吧!  目录 1. 简介 2. 项目搭建 3. 基础知识 3.1. SessionFactory 和Session 3.2. 事务(Transactions) 3.3. 表(Tables) 4. 继承(Inheritance) 5. 关系(Relationships) 5.1. 一对一 5.2. 一对多 5.3. 多对多 5.4. 组件(Components) 6. 用户自定义数据类型 7. 拦截器(Interceptors) 8. 源码下载 简介 Hibernate是Java世界里最流程的对象/关系映射框架(ORM)之一。它允许开发者将普通的Java类的对象结构,映射到数据库中的关系结构。借助于ORM框架,我们的一些工作,比如将内存中的对象实例存储到持久化的数据库,和加载这些数据到原来的对象结构,都变得更加容易。 同时,这些ORM解决方案,比如Hibernate,旨在从那些用于存储数据的数据库产品中建立抽象层。这样,就能够面向不同的数据库产品使用相同的Java代码,而不需面向不同的数据库编写不同的代码,来处理其中细微的差别。 Hibernate也是一个JPA提供者,这意味着它实现了Java持久化API(JPA)。JPA是一个独立于厂商的规范,用于定义Java对象和关系型数据表的映射关系。在终结系列中另一篇文章已经详细解释了JPA,所以我们在本文将重点介绍Hibernate,因此,我们也不会使用JPA注解,而是使用Hibernate专有的配置文件。 Hibernate由三个不同的组件组成: 实体(Entities):Java类(普通Java对象),用于在Hibernate中映射到关系型数据库系统的表。 对象-关系元数据(Object-Relational metadata):实体和关系型数据库的映射信息,可以通过注解(Java 1.5开始支持)实现,或者使用传统的基于XML的配置文件。这些配置信息,用于在运行时执行Java对象和数据库数据的存储和恢复。 Hibernate查询语言(HQL):使用Hibernate时,发送到数据库的查询,不必是原生的SQL格式,而是使用Hibernate专有的查询语言。这些查询语句,会在运行时被翻译成当前应用正在使用的数据库对应方言;所以说,HQL格式的语句是独立于特定数据库供应商的。 在本教程,我们将解释这个框架的各个方面,同时开发一个简单的Java SE应用程序,功能主要包括存储和检索关系型数据库的数据。我们将要使用到的类库/环境如下: maven >= 3.0 :编译环境 Hibernate(4.3.8.Final) H2 (1.3.176):关系型数据库 项目搭建 第一步,我们通过命令行创建一个简单的Maven项目: mvn archetype:create -DgroupId=com.javacodegeeks.ultimate -DartifactId=hibernate 这个命令会在文件系统中生成如下结构: |-- src | |-- main | ...

Read More »

JSP Tutorial – The ULTIMATE Guide


EDITORIAL NOTE: JavaServer Pages (JSP) technology allows you to easily create web content that has both static and dynamic components. JSP technology makes available all the dynamic capabilities of Java Servlet technology but provides a more natural approach to creating static content. The main features of JSP technology include a language for developing JSP pages, which are text-based documents that ...

Read More »

Continuous Integration and Delivery with Docker

Continuous delivery is all about reducing risk and delivering value faster by producing reliable software in short iterations. As Martin Fowler says, you actually do continuous delivery if:                 Your software is deployable throughout its lifecycle. Your team prioritizes keeping the software deployable over working on new features. Anybody can get fast, automated ...

Read More »

If you do it do it right

This is a philosophical or ethical command. Very general. It is something like “fail fast”. The reason it came up to my mind is that I wanted to compile and release License3j using Java 8 and JavaDoc refused to compile during release build. This package is a simple license manager, which has some established user base who require that I ...

Read More »

Groovier Spring Boot Integration Testing


Recently I had a chance to use Groovy’s groovy.json.JsonSlurper in a soapUI REST project. The usage scenario in soapUI (in particular, soapUI Open Source) was very simple: in a Groovy assertion, load the content of a response into a variable and than verify it like this: import groovy.json.JsonSlurper; def slurper = new JsonSlurper() def result = slurper.parseText(messageExchange.responseContent) assert result.incidentType == ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns