Search This Blog

Sunday 24 March 2013

First Look at JPA Annotations

In the earlier posts we saw how to run a JPA application. I decided to have a look at the annotations used in the previous examples.

Tuesday 19 March 2013

persistence.xml

In previous post we have seen the persistence.xml file - the file provides all the configuration information needed to get JPA up and running. We also saw that the JPA standard is very particular of the location of the file.

Sunday 17 March 2013

Working with the Iterator

Before I start let me state that I am still to come across a valid scenario in actual application code where I could find this functionality useful.

Thursday 14 March 2013

My First JPA Application - 3

In the last two posts we setup the code to run a simple JPA example. In this post I shall now test out the code. The code to execute is as below:

Wednesday 13 March 2013

My First JPA Application - 2

In the previous post I created  the project structure for my JPA application. Now to look deeper into the code. I decided to build a simple Pet-Owner relation. One owner can have multiple pets. The java classes for the same is as below:

Tuesday 12 March 2013

My First JPA Application

Till date I have always worked with Hibernate's native API. All my projects involved the SessionFactory, Session and other Hibernate APIs. And it works great. So why should I be looking at JPA ?

Saturday 9 March 2013

Accessing the Request object outside Controllers

We have seen that when working with controllers, Spring automatically gives us access to the HttpServletRequest object. But what if we are in some utility class and would like to access the request ? For this Spring includes the ServletRequestAttributes class.

Thursday 7 March 2013

ROOT.war

Deploying a web application in Tomcat involves placing the war file or the extracted folder in Tomcat's webapps folder. I created a very basic web application named simple and placed it in the webapps folder.

Saturday 2 March 2013

new ArrayList(????)

Writing code without using collections framework would be crazy. They are really cool part of java with a lot of nifty stuff. More importantly unlike arrays you do not have to worry about size management here. The ArrayList will grow as long as  memory is there. No need for the developer to worry about initial size and ArrayIndexOutOfBoundsException.
But what when we are actually asked to watch out our memory footprint ? Can we be memory efficient when we are using Collections ?