Java Code Geeks http://www.javacodegeeks.com/ Java 2 Java Developers Resource Center Thu, 26 Feb 2015 23:00:02 +0000 en-US hourly 1 http://wordpress.org/?v=4.1.1 Hibernate Locking Patterns – How does PESSIMISTIC_READ and PESSIMISTIC_WRITE workhttp://www.javacodegeeks.com/2015/02/hibernate-locking-patterns-how-does-pessimistic_read-and-pessimistic_write-work.html http://www.javacodegeeks.com/2015/02/hibernate-locking-patterns-how-does-pessimistic_read-and-pessimistic_write-work.html#comments Thu, 26 Feb 2015 23:00:02 +0000 http://www.javacodegeeks.com/?p=37459 Introduction Java Persistence API comes with a thorough concurrency control mechanism, supporting both implicit and explicit locking. The implicit locking mechanism is straightforward and it relies on: Optimistic locking: Entity state changes can trigger a version incrementation Row-level locking: Based on the current running transaction isolation level, the INSERT/UPDATE/DELETE statements may acquire exclusive row locks […]

 

]]>
http://www.javacodegeeks.com/2015/02/hibernate-locking-patterns-how-does-pessimistic_read-and-pessimistic_write-work.html/feed/ 0
Fetching List of message codes from message.propertieshttp://www.javacodegeeks.com/2015/02/fetching-list-of-message-codes-from-message-properties.html http://www.javacodegeeks.com/2015/02/fetching-list-of-message-codes-from-message-properties.html#comments Thu, 26 Feb 2015 20:00:21 +0000 http://www.javacodegeeks.com/?p=37552 Normally messages from message properties are fetched via, key i.e. message code, What if we want to select more than one message property, like a list. To get a list of select message codes from message.properties, we need to customize messageSource bean. To do that, lets create a class ‘CustomisedPluginAwareResourceBundleMessageSource’ which should extend class ‘PluginAwareResourceBundleMessageSource’. […]

 

]]>
http://www.javacodegeeks.com/2015/02/fetching-list-of-message-codes-from-message-properties.html/feed/ 0
Thoughts about TDD and how to use it for untested legacy codehttp://www.javacodegeeks.com/2015/02/thoughts-about-tdd-and-how-to-use-it-for-untested-legacy-code.html http://www.javacodegeeks.com/2015/02/thoughts-about-tdd-and-how-to-use-it-for-untested-legacy-code.html#comments Thu, 26 Feb 2015 17:00:18 +0000 http://www.javacodegeeks.com/?p=37544 Prologue My personal experiences with TDD mostly match with the others on the internet, in short, TDD is good. It helps you to write better code, create a clean and nicely tested architecture, make refactoring and design changes easier. It leads your design decisions, helps to think through every possible cases which you need to […]

 

]]>
http://www.javacodegeeks.com/2015/02/thoughts-about-tdd-and-how-to-use-it-for-untested-legacy-code.html/feed/ 0
RESTful Charts with JAX-RS and PrimeFaceshttp://www.javacodegeeks.com/2015/02/restful-charts-with-jax-rs-and-primefaces.html http://www.javacodegeeks.com/2015/02/restful-charts-with-jax-rs-and-primefaces.html#comments Thu, 26 Feb 2015 14:00:13 +0000 http://www.javacodegeeks.com/?p=37444 Oftentimes, it is useful to utilize a chart for providing a visual representation of your data. PrimeFaces supplies charting solutions that make it easy to add visual representations of your data into web and mobile applications. If we couple the use of PrimeFaces charting components with RESTful web service data, we can create custom charts […]

 

]]>
http://www.javacodegeeks.com/2015/02/restful-charts-with-jax-rs-and-primefaces.html/feed/ 0
Async abstractions using rx-javahttp://www.javacodegeeks.com/2015/02/async-abstractions-using-rx-java.html http://www.javacodegeeks.com/2015/02/async-abstractions-using-rx-java.html#comments Thu, 26 Feb 2015 11:00:11 +0000 http://www.javacodegeeks.com/?p=37443 One of the big benefits in using Rx-java for me has been the way the code looks exactly the same whether the underlying calls are synchronous or asynchronous and hence the title of this entry. Consider a very simple use case of a client code making three slow running calls and combines the results into […]

 

]]>
http://www.javacodegeeks.com/2015/02/async-abstractions-using-rx-java.html/feed/ 0
Dropwizard, MongoDB and Gradle Experimentinghttp://www.javacodegeeks.com/2015/02/dropwizard-mongodb-and-gradle-experimenting.html http://www.javacodegeeks.com/2015/02/dropwizard-mongodb-and-gradle-experimenting.html#comments Thu, 26 Feb 2015 08:00:54 +0000 http://www.javacodegeeks.com/?p=37442 Introduction I created a small project using Dropwizard, MongoDB and Gradle. It actually started as an experimenting Guava cache as buffer for sending counters to MongoDB (or any other DB). I wanted to try Gradle with MongoDB plugin as well. Next, I wanted to create some kind of interface to check this framework and I […]

 

]]>
http://www.javacodegeeks.com/2015/02/dropwizard-mongodb-and-gradle-experimenting.html/feed/ 0
Resolve coreference using Stanford CoreNLPhttp://www.javacodegeeks.com/2015/02/resolve-coreference-using-stanford-corenlp.html http://www.javacodegeeks.com/2015/02/resolve-coreference-using-stanford-corenlp.html#comments Thu, 26 Feb 2015 05:00:54 +0000 http://www.javacodegeeks.com/?p=37441 Coreference resolution is the task of finding all expressions that refer to the same entity in a text. Stanford CoreNLP coreference resolution system is the state-of-the-art system to resolve coreference in the text. To use the system, we usually create a pipeline, which requires tokenization, sentence splitting, part-of-speech tagging, lemmarization, named entity recoginition, and parsing. […]

 

]]>
http://www.javacodegeeks.com/2015/02/resolve-coreference-using-stanford-corenlp.html/feed/ 0
Pass Streams Instead of Listshttp://www.javacodegeeks.com/2015/02/pass-streams-instead-of-lists.html http://www.javacodegeeks.com/2015/02/pass-streams-instead-of-lists.html#comments Wed, 25 Feb 2015 23:00:52 +0000 http://www.javacodegeeks.com/?p=37436 Opening disclaimer: this isn’t always a good idea. I’ll present the idea, along with some of the reasons why it’s a good idea, but then I’ll talk about some instances where it’s not so great. Being Lazy As you may know, I’ve been dabbling in Python nearly as much as I’ve been working with Java. […]

 

]]>
http://www.javacodegeeks.com/2015/02/pass-streams-instead-of-lists.html/feed/ 0
Simplifying JAX-RS caching with CDIhttp://www.javacodegeeks.com/2015/02/simplifying-jax-rs-caching-with-cdi.html http://www.javacodegeeks.com/2015/02/simplifying-jax-rs-caching-with-cdi.html#comments Wed, 25 Feb 2015 20:00:47 +0000 http://www.javacodegeeks.com/?p=37434 This post explains (via a simple example) how you can use CDI Producers to make it a little easier to leverage cache control semantics in your RESTful services The Cache-Control header was added in HTTP 1.1 as a much needed improvement over the Expires header available in HTTP 1.0. RESTful web services can make use […]

 

]]>
http://www.javacodegeeks.com/2015/02/simplifying-jax-rs-caching-with-cdi.html/feed/ 0
Starting out with jHiccuphttp://www.javacodegeeks.com/2015/02/starting-out-with-jhiccup.html http://www.javacodegeeks.com/2015/02/starting-out-with-jhiccup.html#comments Wed, 25 Feb 2015 17:00:33 +0000 http://www.javacodegeeks.com/?p=37432 After writing my post on ‘How to detect and diagnose slow code in production’ I was encouraged by a reader to try out jHiccup from Azul systems. Last year I went to a talk by jHiccup’s creator Gil Tene on the correct way to measure latency, where, amongst other things, he introduced us to jHiccup. It […]

 

]]>
http://www.javacodegeeks.com/2015/02/starting-out-with-jhiccup.html/feed/ 0