Search This Blog

Tuesday, 30 July 2013

Order and Occurence indicators in xsd

Unlike simple types, complex types can have nested elements. Consider the below complex type:
<element name="address">

Sunday, 28 July 2013

Table names - does the case matter ?

In one of my previous projects I encountered a strange issue. The SQL queries that worked in our development code always failed on the server. The logs indicated that the queried tables did not exist.
This did not make any sense to us. The code ran perfectly on local MySQL database installed on our developer machines. But the minute we did it on the server we got table does not exist error. After a lot of digging we discovered that there was no problem in the code. Our table name in the ddl queries was in lower case but in our code it was in title case. But why did it work on Windows then. Some searching on the net explained the actual cause of the issue.
From the MySql docs:
In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory (and possibly more, depending on the storage engine). Consequently, the case sensitivity of the underlying operating system plays a part in the case sensitivity of database and table names. This means database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix
Our development machines were using Windows operating systems. In Windows you cannot have two files in same directory with same names but different cases. So the case difference did not cause any problems on Windows. MySql was able to find the table correctly on the file system and all things worked fine. But our test server was a linux environment. The table in the SQL query was not same as the table in the database. Result - requested table not found.
Our solution was to create constants in the code to hold our table names in small case and to ensure that all references in our queries used these values only.
An alternative action to doing drop/rename is also available in MySql docs.
How table and database names are stored on disk and used in MySQL is affected by the value of lower_case_table_names. Changing this value on linux can make MySQL use Windows style treatment for the tables.

Friday, 26 July 2013

Filters and Spring

I guess we have all used filters in our web applications. With the arrival of spring and its very solid front controller, code that was in filters is most of the time placed in Spring interceptors. But that does not mean that we cannot add a filter.

Monday, 22 July 2013

Stacks in JDK

In the previous post we saw the various queue implementations available in Java. Today I decided to check out stacks:
public static void main(final String[] args) {

Wednesday, 17 July 2013

Conduits in CXF

If we observe any page request sent by a browser, it will be seen to be composed of multiple headers. Consider the below screenshot taken for a simple AJAX request.

Thursday, 11 July 2013

Combine CREATE and UPDATE operations in REST

I was searching the net on good practices for developing RestFull services when I came across this interesting discussion on stack overflow:
The question was "Should we use PUT or POST for Create Resource ?"

Monday, 8 July 2013

POST with a location

IN the last few posts I have been trying out Springs REST API. For the create operation we had used a POST call. The API would take an user resource, create it and return the user resource in the response stream.

Saturday, 6 July 2013


In the previous post we saw several of the JPA annotations. The one that occurs most commonly is the Column annotation can be used without any attributes.