August 2013 Posts

[Book Review] Packt Publishing’s Ebook, Java Persistence with MyBatis 3

Among lots of java frameworks, MyBatis is a very popular especially because it is a database-centric-framework and it has a shallow and short learning curve, and today im trying to do a book review for it. The book that i want to review is Packt Publishing’s Java Persistence with MyBatis 3. You can see the ebook on this link,

This book’s author, K. Siva Prasad Reddy, really show the reasons of why MyBatis is very popular by providing with various code samples, from simple “down to earth” codes to a much more complicated codes, such as Spring Framework integration and Caching strategy.

These are the Table of Contents of the book,
Chapter 1: Getting started with MyBatis
Chapter 2: Bootstrapping
Chapter 3: SQL Mappers using XML
Chapter 4: SQL Mappers using Annotations
Chapter 5: Integration with Spring

So needless to say, this is the kind of ebook that i wish i had read since long time ago.


[Java] How to Convert XMLGregorianCalendar to java.util.Date and The Other Way Around

This is a simple code snippet on how to convert XMLGregorianCalendar into java.util.Date and java.util.Date into javax.xml.datatype.XMLGregorianCalendar. Usually i found XMLGregorianCalendar everytime im trying to convert java bean into webservice using wsdl2java.

But there are some time when i need to convert those XMLGregorianCalendar objects and change them into java.util.Date so i could do a much more various process on them. So this is how i convert XMLGregorianCalendar into java.util.Date,

            XMLGregorianCalendar calendar = responseMessage.getDate();
            java.util.Date date = calendar.toGregorianCalendar().getTime();

and this is how i convert java.util.Date into XMLGregorianCalendar

            GregorianCalendar gregorianCalendar = new GregorianCalendar();
            gregorianCalendar.setTime(new Date());
            responseMessage.setDate(new XMLGregorianCalendarImpl(gregorianCalendar));

For example, im using XMLGregorianCalendar value “2012-10-15T00:00:00″. Hope it would help others (H)


How To Change Apache Tomcat’s Server Name

On this tutorial, i’ll show you how to change Apache Tomcat’s server name. This is the screenshot from a regular Apache Tomcat,

And with a simple configuration on server.xml,

 <Connector port="8080" protocol="HTTP/1.1"
	 server="Why So Serious"
         redirectPort="8443" />

It will change my Tomcat’s server name into,

Not hard actually ;-)