-
Recent Posts
Recent Comments
- sherif sadek on Understanding Hibernate session flushing
- Koushik Paul on Hibernate query limitations and correlated sub queries
- Joseph Albert on Showing unused TestNG tests
- Iván on Maven offline build fails to resolve artifacts in your local repository
- Peter on Comparing two MySQL databases
Archives
- October 2023
- July 2023
- January 2023
- July 2022
- September 2021
- August 2021
- July 2021
- June 2021
- May 2021
- December 2020
- June 2020
- May 2020
- January 2019
- November 2018
- September 2017
- June 2017
- September 2016
- August 2016
- February 2016
- July 2015
- November 2014
- October 2014
- August 2014
- April 2014
- February 2014
- December 2013
- November 2013
- May 2013
- February 2013
- January 2013
- October 2012
- September 2012
- July 2012
- April 2012
- February 2012
- January 2012
- November 2011
- October 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- November 2010
- October 2010
Categories
Meta
Category Archives: Java
Memory leak with TestNG and Spring DirtiesContext annotation
We recently added some new integration tests to our test suite. All three tests were Spring integration tests. Normally in a Spring integration test, the entire code for a test method operates in a single transaction, and at the end … Continue reading
IntelliJ Hints and Tips
Most useful keyboard shortcuts (these are for Mac): CMD + O Open class CMD + SHIFT + OOpen file CMD + F Find in file CMD + R Replace in file CMD + SHIFT + F Find in path CMD … Continue reading
log4j in maven tests
If you want to specify log4j configuration when running tests via Maven, you can do so by updating the Maven surefire plugin configuration to point to a specific log4j configuration file. For log4j v2 the appropriate parameter is called log4j.configuration. … Continue reading
Generating code with JavaPoet
Why write code when you can generate it? There are lots of situations when it makes more sense to generate. In this article I’m going to work through an example of how to use JavaPoet and Apache BeanUtils to write … Continue reading
Writing a custom spliterator in Java 8
In this article I’m going to give two examples of writing a custom spliterator in Java 8. What is a spliterator and why would you need to write your own? Well, a spliterator is used by the Java streams code … Continue reading
Posted in Java, Uncategorized
Leave a comment
Using Optional in Java 8
“The introduction of null references was my billion dollar mistake” – Tony Hoare Optional is a (typed) container object. It may contain a single object, or it may be empty. It allows you to avoid null pointer exceptions. In this … Continue reading
Java 8 Streams Tutorial
In this tutorial, I’m going to start by explaining some of the basics of streams. Viz: What streams are Terminal and non-terminal operations Their “lazy” nature Their read-once nature Why they were introduced i.e. how they enable easy parallel operations … Continue reading
Yet another Java 8 custom collector example
Java 8 introduces a number of functional programming techniques to the language. Collections can be turned into streams which allows you to perform standard functional operations on them, such as filtering, mapping, reducing and collecting. In this post I’m going … Continue reading
Hibernate example 4 – many to many associations
I’ve put some code on Github that shows three ways of modelling many to many associations with JPA / Hibernate: Using a join table that is not mapped as either an entity or an embedded component type. Mapping the join … Continue reading
Hibernate example 3 – one to one associations
Just put a Hibernate example of the three different ways to create one-to-one associations on github: https://github.com/hedleyproctor/hibernate-one-to-one It contains a Customer entity, which has one-to-one associations to a UserProfile, MarketingPreferences and a Wistlist. Foreign key relationship. Customer has a foreign … Continue reading