Posts

Showing posts from September, 2016

Hibernate - Exception "node to traverse cannot be null"

Problem:Hibernate exception "java.lang.IllegalArgumentException: node to traverse cannot be null"
Query query = session.createQuery("delete " +
"(...) " +
"where map_material.id > map_material_1.id " +
" and map_material.map_key = map_material_1.map_key " +
"(...) "
Solution:Make sure to use hibernate "createSQLQuery" method
Query query = session.createSQLQuery("delete " +
"(...) " +
"where map_material.id > map_material_1.id " +
"and map_material.map_key = map_material_1.map_key " +
"(...) "

Java - Transform string list into list

Problem:Transform a list of strings into a single string. One solution is to iterate over the list and append its contents. Remember that StringBuilder's append is much faster than Strings concatenation.

Solution:A better solution is relying on Java StringJoiner


, or with Java 8



Jongo Mongo - Unwind with match example

Example of an unwind query in Jongo
MongoDB query

Jongo query