Java Code Geeks http://www.javacodegeeks.com/ Java 2 Java Developers Resource Center Fri, 29 May 2015 19:00:40 +0000 en-US hourly 1 http://wordpress.org/?v=4.2.2 Saving an image in a SQLite database in your Android applicationhttp://www.javacodegeeks.com/2015/05/saving-an-image-in-a-sqlite-database-in-your-android-application.html http://www.javacodegeeks.com/2015/05/saving-an-image-in-a-sqlite-database-in-your-android-application.html#comments Fri, 29 May 2015 19:00:40 +0000 http://www.javacodegeeks.com/?p=40354 When you start caching data to a local database from your Android application, sooner or later you’ll need to save images in that database too. For example, if you’re storing reports about observations the users make in the field that will be uploaded to the main system later, it can be handy to add a ...

 

]]>
http://www.javacodegeeks.com/2015/05/saving-an-image-in-a-sqlite-database-in-your-android-application.html/feed/ 0
Type Safe Queries for JPA’s Native Query APIhttp://www.javacodegeeks.com/2015/05/type-safe-queries-for-jpas-native-query-api.html http://www.javacodegeeks.com/2015/05/type-safe-queries-for-jpas-native-query-api.html#comments Fri, 29 May 2015 10:00:26 +0000 http://www.javacodegeeks.com/?p=40353 When you’re using JPA – sometimes – JPQL won’t do the trick and you’ll have to resort to native SQL. From the very beginning, ORMs like Hibernate kept an open “backdoor” for these cases and offered a similar API to Spring’s JdbcTemplate, to Apache DbUtils, or to jOOQ for plain SQL. This is useful as ...

 

]]>
http://www.javacodegeeks.com/2015/05/type-safe-queries-for-jpas-native-query-api.html/feed/ 0
Monolithic core vs full microservice architecturehttp://www.javacodegeeks.com/2015/05/monolithic-core-vs-full-microservice-architecture.html http://www.javacodegeeks.com/2015/05/monolithic-core-vs-full-microservice-architecture.html#comments Fri, 29 May 2015 07:00:25 +0000 http://www.javacodegeeks.com/?p=40352 Martin Fowler recently released another article on microservices, specifically about the hype surrounding them. He states that though microservices are a hot topic right now, they add unnecessary complexity to systems that would do just fine with a single monolithic application built with good modularity. While I agree with his point that microservices do add ...

 

]]>
http://www.javacodegeeks.com/2015/05/monolithic-core-vs-full-microservice-architecture.html/feed/ 0
A Few Thoughts on Unit Test Scaffoldinghttp://www.javacodegeeks.com/2015/05/a-few-thoughts-on-unit-test-scaffolding.html http://www.javacodegeeks.com/2015/05/a-few-thoughts-on-unit-test-scaffolding.html#comments Fri, 29 May 2015 07:00:17 +0000 http://www.javacodegeeks.com/?p=40328 When I start to repeat myself in unit test methods by creating the same objects and preparing the data to run the test, I feel disapointed in my design. Long test methods with a lot of code duplication just don’t look right. To simplify and shorten them, there are basically two options, at least in ...

 

]]>
http://www.javacodegeeks.com/2015/05/a-few-thoughts-on-unit-test-scaffolding.html/feed/ 0
Neo4j: The foul revenge graphhttp://www.javacodegeeks.com/2015/05/neo4j-the-foul-revenge-graph.html http://www.javacodegeeks.com/2015/05/neo4j-the-foul-revenge-graph.html#comments Thu, 28 May 2015 19:00:16 +0000 http://www.javacodegeeks.com/?p=40351 Last week I was showing the foul graph to my colleague Alistair who came up with the idea of running a ‘foul revenge’ query to find out which players gained revenge for a foul with one of their own later in them match. Queries like this are very path centric and therefore work well in ...

 

]]>
http://www.javacodegeeks.com/2015/05/neo4j-the-foul-revenge-graph.html/feed/ 0
Puzzler: nested computeIfAbsenthttp://www.javacodegeeks.com/2015/05/puzzler-nested-computeifabsent.html http://www.javacodegeeks.com/2015/05/puzzler-nested-computeifabsent.html#comments Thu, 28 May 2015 13:00:36 +0000 http://www.javacodegeeks.com/?p=40329 Overview The Java 8 libraries have a new method on map, computeIfAbsent. This is very useful way to turn your Map into a cache of objects associated with a key. However, there is a combination you might not have considered; what happens if you call computeIfAbsent inside itself. map.computeIfAbsent(Key.Hello, s -> { map.computeIfAbsent(Key.Hello, t -> ...

 

]]>
http://www.javacodegeeks.com/2015/05/puzzler-nested-computeifabsent.html/feed/ 0
Rethinking database schema with RDF and Ontologyhttp://www.javacodegeeks.com/2015/05/rethinking-database-schema-with-rdf-and-ontology.html http://www.javacodegeeks.com/2015/05/rethinking-database-schema-with-rdf-and-ontology.html#comments Thu, 28 May 2015 10:00:08 +0000 http://www.javacodegeeks.com/?p=40327 When I joined the industry 10 years ago, my first project used relational database. After that, my next project also used relational database. And as you may guess, my next next projects also used relational database. This went on for so long that I almost forgot that table is just one format to store data. ...

 

]]>
http://www.javacodegeeks.com/2015/05/rethinking-database-schema-with-rdf-and-ontology.html/feed/ 0
Screenshot of the Week: Missing JREhttp://www.javacodegeeks.com/2015/05/screenshot-of-the-week-missing-jre.html http://www.javacodegeeks.com/2015/05/screenshot-of-the-week-missing-jre.html#comments Thu, 28 May 2015 07:00:51 +0000 http://www.javacodegeeks.com/?p=40325 One of the more frustrating things about Eclipse–at least for some users–is that Eclipse doesn’t come with a Java Runtime Environment (JRE). Since Eclipse is itself a Java application, it needs a JRE to run. The intellectual property rules at Eclipse prevent us from including a JRE with the downloads, so you have to go and ...

 

]]>
http://www.javacodegeeks.com/2015/05/screenshot-of-the-week-missing-jre.html/feed/ 0
How does Hibernate READ_WRITE CacheConcurrencyStrategy workhttp://www.javacodegeeks.com/2015/05/how-does-hibernate-read_write-cacheconcurrencystrategy-work.html http://www.javacodegeeks.com/2015/05/how-does-hibernate-read_write-cacheconcurrencystrategy-work.html#comments Wed, 27 May 2015 19:00:25 +0000 http://www.javacodegeeks.com/?p=40260 Introduction In my previous post, I introduced the NONSTRICT_READ_WRITE second-level cache concurrency mechanism. In this article, I am going to continue this topic with the READ_WRITE strategy. Write-through caching NONSTRICT_READ_WRITE is a read-through caching strategy and updates end-up invalidating cache entries. As simple as this strategy may be, the performance drops with the increase of ...

 

]]>
http://www.javacodegeeks.com/2015/05/how-does-hibernate-read_write-cacheconcurrencystrategy-work.html/feed/ 0
The structure of Apache Lucenehttp://www.javacodegeeks.com/2015/05/the-structure-of-apache-lucene.html http://www.javacodegeeks.com/2015/05/the-structure-of-apache-lucene.html#comments Wed, 27 May 2015 13:00:26 +0000 http://www.javacodegeeks.com/?p=40259 The inestimably noble Apache Software Foundation produces many of the blockbuster products (Ant, CouchDB, Hadoop, JMeter, Maven, OpenOffice, Subversion, etc.) that help build our digital universe. One perhaps less well-known gem is Lucene, which, ” … provides Java-based indexing and search technology, as well as spellchecking, hit highlighting and advanced analysis/tokenization capabilities.” Despite its shying ...

 

]]>
http://www.javacodegeeks.com/2015/05/the-structure-of-apache-lucene.html/feed/ 0