Skip to main content

Posts

Showing posts from 2013

Hibernate And Mapping enum to customized values

With Hibernate, enums can be easily mapped either by enum item name or the position of each item but what if you want to map it to a customized value? In my case, we have so many one-character long columns in our tables, representing flags, statuses etc. We have heaps of them. Writing UserTypes for each enum field is very boring and nasty job. As every where you see in internet, you need to keep a Map for each user-type in order to map those values to enum elements. So to avoid this, I ended up with something more clean, easy and more generic. Now imagine you have following enum: public enum PaymentFrequencyEnum { WEEKLY("WK"), FORTNIGHTLY("FN"), MONTHLY("MT"), QUARTERLY("QL"), YEARLY("YL"); private String value;     private PaymentFrequency(String value) { this.value = value; } } I've chosen two-letter code as value so that you understand m

Migrating from OJB to Hibernate

Okay now I have to migrate a dozen of domain objects from OJB to Hibernate entities and since we still have to use hbm files as opposed to Annotation, this is no enjoying task... I found this XML Stylesheet from this website below but had to make some changes in order to get it working... so I thought it may help someone: Download XSL file here Original file can be found here but so far at this time which is 16th of December 2013 and 6:37pm, it's not working properly :) martindavidsson blog

JSF or GWT?

I have worked with JSF for almost 4 years. First time when I had a chance to work with GWT, I was very excited. Like many Java developers I was like 'Wow I don't need to play with those bloody tags and elements and now it's pure Java code!!!'... I was so happy but my happiness didn't last very long. Programming is my passion. I hate writing codes that become a mess later and unfortunately this is what will eventually happen with GWT. The thing is you can't rely on reviews and features of a software or an API, in action everything goes different way. Specially when it comes to large scaled application and in an environement where everything is urgent and importnat... well, I think all software companies are the same in this regard... The fact is that in a team of developers not every one cares about best practices, design patterns and even if you have very experienced designer, solution architect etc, still you can't force the team to deve

Introduction

Hi My name is Mohammad. I am a passionate Java developer. When I was in university, I was very interested in Borland Delphi and Turbo C++ they were hot at those ages but I ended up with my first job as Oracle Developer. I was lucky because Delphi was about to die and now we can call it an ancient programming language! It is back to its hometown: Delphi Temple :) So after two years working with Oracle Form Builder and Oracle database, I attracted to Java. So first thing I learned was Apache Struts 1.1. It was awesome however now every body smiles when you mention it :) Very soon I switched to JSF and JBoss. But they were very young at that time. I also worked with Beehive from Apache which nobody may heard about it :) I worked with Apache Lucene, JSF and JBoss Seam for about two years and then I packed my bag to work in back end. I love back end programming! My best years of working was in a Banking software company which I had oppurtunity to design and develop some big applic