Author Archives: Robert Piasecki

About Robert Piasecki

Husband and father, Java software developer, Linux and open-source fan.

Default and static methods in interfaces in Java 8

Before Java 8 interfaces could only contain static fields (usually simple constants) and abstract methods. Java 8 provided the ability to define concrete (default and static) methods in interfaces. This new language feature is used extensively in Java core packages. … Continue reading

Posted in Java | Tagged | 1 Comment

Database schema creation in JPA using SQL scripts

Recent versions of JPA provide a feature to automatically create the database objects (like tables, sequences or indexes), load initial data into database on application deployment; and also remove them after the application is undeployed. All that is needed is … Continue reading

Posted in Hibernate, Java, Java EE, JPA | Tagged , , , | Leave a comment

Reading text file line by line in Java

Reading text files from hard disk is quite common task in software development practice. Usually we are interested in processing it line by line. In this article I would like to present few popular ways how to do it easily … Continue reading

Posted in Java | Tagged , | Leave a comment

Iterating through Java list backwards

The most natural method of iterating through a list in Java is to start from the first element of the list and then move forward until the last one is reached. While this is the most common, it is sometimes … Continue reading

Posted in Guava, Java | Tagged , | 1 Comment

Usage of serialVersionUID in Java serialization

Java run-time associates with each serializable class a special version number known as serialVersionUID. This number is later used during deserialization process to verify if the application which performed the serialization and the application which is doing the deserialization have … Continue reading

Posted in Java | Tagged | Leave a comment

Creating executable jar file with Maven

Building an executable jar file with maven-jar-plugin is fairly easy. However, it has one disadvantage that the Maven dependencies are not packaged together inside the resulting jar file but have to be stored separately on the file system and added … Continue reading

Posted in Java, Maven | Tagged , | 4 Comments

Customizing HTML file input style

Styling an HTML file input control is very cumbersome and the number of available options is quite limited. Moreover, each web browser renders this control differently which makes it difficult to have consistent view of the application between browsers. Here … Continue reading

Posted in HTML | Tagged , | 1 Comment

Primary key generation in JPA

Generation of primary key values is a very important functionality of relational database management systems. The main idea is to let RDBMS automatically calculate and assign primary key value to the row being inserted into the database table. This not … Continue reading

Posted in Database, Java, Java EE, JPA | Tagged , , , | 4 Comments

Charts with jqPlot, Spring REST, AJAX and JQuery

One of the most notable features of HTML5 is Canvas API which provides a rectangular region for custom drawing. There are several uses of it like: building games, image compositions, animations but this time we will see how to use … Continue reading

Posted in AJAX, Java, Spring | Tagged , , , , , , | 1 Comment

Accessing local files from a web browser using HTML5 File API

HTML5 introduced a standard interface called File API which lets programmers access meta-data and read contents of local files selected by a user. The selection is typically done using input element but the recent browsers also allow using drag and … Continue reading

Posted in HTML, JavaScript | Tagged , , | 1 Comment