On Java Development

All things related to Java development, from the perspective of a caveman.

Archive for the ‘Java Strings’ Category

Creating Class Level Messages

without comments

Introduction

This post presents a method for creating class-level messages. Granted, there are other approaches that could be cited however, this approach shows how long messages intended for logging purposes can be constructed. The messages are confined to the single class that will be responsible for sending them to the logger when the need arises.

Read the rest of this entry »

Written by admin

October 22nd, 2014 at 6:34 am

Posted in Java Strings

Creating Summary Data using SQL Count(*) and Hibernate

without comments

Introduction

This post shows how to implement a SQL statement with a Count(*) function using Hibernate. This creates a record set that doesn’t map to an existing entity, so the coding needed to pull the data out of the resulting list and to then put them into a container class is a bit different than usual when using Hibernate and mapped entities.

This post also goes beyond being a simple presentation about an SQL statement inside a DAO. Along the way, it explains many Java development concepts that every developer should know. It also exposes forces that should cause the developer to recognize the need for a certain Java Design Pattern.

Maybe this post should have been called “How to Design an Application to use a Mini-Architecture including Services, Business Objects, Data Access and Transfer Objects while using Hibernate to summarize records.“, but the focus is still about how to use the Count(*) function with Hibernate.
Read the rest of this entry »

The Immutable String and Performance

without comments

Introduction

Objects of the String class are immutable. If you examine the JDK documentation for the String class, you’ll see that every method in the class that appears to modify a String actually creates and returns a brand new String object containing the modification. The original String is left untouched and memory is used to contain each string object. Over time and across multiple applications, these unused objects will come under the purview of the JVM’s garbage collection cycle which can impact performance of the application server.
Read the rest of this entry »

Written by admin

March 28th, 2014 at 7:19 am

Posted in Java Strings