Category Archives: Java

Java Programming

Hibernate and Composite keys

I like using surrogate keys for most of the database designs for the following reasons: Simplifies design and may improve efficiency Maintainability: Change to the meaning of the natural key could change the table structures when using natural keys Natural … Continue reading

Posted in Hibernate, Java | Tagged , , | 2 Comments

Mock objects and Testing

This has been a much discussed topic over the web in the last couple of years. I was responding to one of the emails at work about mock objects. While organizing my thoughts about Mock objects, I decided to write this post.   … Continue reading

Posted in Agile, Java | Tagged , | Leave a comment

Application Configuration properties simplified by Spring

The combination of PropertyPlaceholderConfigurer and PropertyOverrideConfigurer classes in Spring Beans API have been invaluable for me to simplify configuration properties for a few of applications I have worked-on recently. The placeholder configurer helps us to share the properties across various … Continue reading

Posted in Java | Tagged , , , | Leave a comment

Best way to demo/learn a Java-based API

I designed and implemented a dual-API SDK at my current job. This dual-API SDK did not initially run on any application server. During this implementation, I learnt that it is best to use a dynamic language like JRuby or JPython or Groovy for … Continue reading

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

OSGi for Web Applications?

Web applications are the most common type of deployments on the application servers. So, if OSGi is going to be a serious contender in the application server market, I would expect it to have great support for deploying web applications … Continue reading

Posted in Java, OSGi, Web Technologies | Tagged , , , , , | Leave a comment

Hibernate direct field acess and encapsulation

I am a big fan of the Hibernate’s direct field access functionality. I am not sure why ”property” access is the default instead of “field”. Direct field access allows me to control the number of getters/setters that are actually needed from the DAO Client’s perspective. … Continue reading

Posted in Hibernate, Java | Tagged , , | 1 Comment

Missing “friend” class access specifier in Java?

I am in the process of rearchitecting a fairly large legacy web application. Almost all of the classes in the old code base are public classes with the key classes containing mostly public (and sometimes static) methods. I am tasked to modularize this application … Continue reading

Posted in Java | Tagged , , | 2 Comments

Essentials for OSGi-based middleware development

Here are the things every Java developer working on OSGi-based middleware must know, IMO: Essentials: Design-by-Contract & SOA Component/Package Versioning OSGi Bundle Lifecycle Bundle Manifest directives Core OSGi services Spring DM (especially for simplification of the usage of OSGi services and writing … Continue reading

Posted in Java, OSGi, Uncategorized | Tagged , , | Leave a comment

OutOfMemoryError: PermGen space

Today, during load testing I saw one of those dreaded “java.lang.OutOfMemoryError: PermGen space” errors on our fairly large web application deployed in Tomcat running on Sun JDK 1.5. We used to use the default (64m) for the perm space. I bumped it … Continue reading

Posted in Java, Performance tuning | Tagged , | Leave a comment

OSGi – the next Java Middleware technology

I think the Java developers (especially server side developers) have started looking at OSGi as the next-generation Java Middleware technology. This may not come as a surprise because of the adoption of OSGi by the JEE server vendors and Java (server, desktop … Continue reading

Posted in Java, OSGi | Tagged , , , | Leave a comment