Polymorphic Association Mapping with Any Relationship in Hibernate


Polymorphic association, supported by Hibernate, is the solution of such mapping requirement as an instance of entity needs to be associated with one of multiple possible entities. This can be implemented with Any relationship. In this relationship, the table holding the relationship would have two columns for relationship management. One to identify the primary key […]

Creating Managed Threads Using ManagedThreadFactory in Java EE 7 – Part 3


So far we have seen: In Part-1: Creating ManagedExecutorService to submit a single task or a list of tasks where each task would be an implementation of either Callable or Runnable interface. In Part-2: Creating ManagedScheduledExecutorService for scheduling tasks to run at a later time or to schedule repeating tasks. In this post, which will […]

ManagedScheduledExecutorService for Implementing Concurrency Utilities in Java EE 7 – Part 2


In my previous post you saw how to use the concurrency utilities in Java EE 7 by using the ManagedExecutorService. In this post we will have a look at a variant of this i.e the ManagedScheduledExecutorService. ManagedScheduledExecutorService is used to schedule tasks to be executed in future by specifying the delay in terms of SECONDS, […]

ManagedExecutorService for Implementing Concurrency Utilities in Java EE 7 – Part 1


Prior to Java EE 7 one could make use of the concurrency utilities present in java.util.concurrent package or the java.lang.Thread or java.lang.Runnable. But it was not considered a best practice, not a standard and not safe for the application. This was because the Java EE web and EJB containers instantiate objects using container-managed thread pools […]

How to use Spring EL in XML configurations?


In our previous tutorial we have explained in detail about how to use the spring expression language. This tutorial is a simple example to demonstrate how to use the expression language in XML configuration file. Employee.java Company.java SpringExpressionDemo.java beans.xml If you run the above example program, you will get the output as: I hope this […]

Use @Import for Importing JavaConfig Files in Spring Projects


In my previous article I have explained about the JavaConfig in Spring 3.0. It is a new way of configuring the bean definitions without using the traditional XML files. Also I have listed the annotations defined as part of JavaConfig approach. In the list, @Import is the one such annotation used for consolidating all the […]

JavaConfig in Spring 3.0


Spring 3.0 has introduced new way for configuring the spring beans. In fact this was maintained by spring framework separately as JavaConfig. Later it is merged to the spring core framework and all the features are directly accessible from the spring core. Instead of using the XML files, we can use plain Java classes to […]

How to Protect PDF with Password using iText in Java?

PDF Thumbnail

In my previous article I have explained about how to create PDF document using iText with simple example. This tutorial explains how to add a password protection for your PDF document. iText doesn’t provide the password feature in its own API, however it internally uses another third part implementation and implements the password protection. iText internally […]

How to Create PDF using iText in Java?

PDF Thumbnail

Generating PDF report is the very general requirement in most of the Java projects. iText is the most popular PDF API used by the Java developers for generating the PDF report. It is very simple and easy to get started writing simple PDF files. If you are familiar with iText API,  it provides more advanced […]

How To Convert Properties File Into XML File Using Java?


In my previous tutorials I have explained about how to use DOM Parser and SAX Parser. This tutorial explain with very simple utility method available in the Java package used for converting your existing properties file to a XML file. Sometimes this may be the requirement for Java developers, instead of manually converting properties file […]