Create a Maven archetype from an existing project on Eclipse

First, a mvn archetype:create-from-project and a mvn install on the created archetype in target/generated-sources/archetype directory.

A directory, named ${groupId}/${artifactId}-archetype, containing a jar and pom.xml is generated into the repository.

A mvn archetype:crawl -Drepository=/path/to/.m2 is then used to generate the archetypes catalog. The archetype-catalog.xml file is by default generated in .m2/repository (this can be changed while using the parameter -Ddirectory=/path/for/xml)

Finally, in Eclipse, go to Window > Prefences > Maven > Archetypes > Add local catalog, enter the name and directory of this catalog.

When you create a new Maven project on Eclipse, you can select your ${groupId}/${artifactId}-archetype in your catalog freshly named.

More on :

Maven webapp on Eclipse with Tomcat

I finally did it !!!!!!!!!!!!

I manage to configure a Maven webapp to run on a Tomcat Server to test the JSPs on Eclipse.

.: To Complete :.

1. Create a library for Tomcat JARs
Window > Preferences > Java > Build Path > User Libraries

2. Add this library to classpath with maven-eclipse-plugin


A big thank to that site

Let’s code then 😀

Mapping large String to Clob for Oracle with Hibernate and Spring

By default String mapping is limited to 4000 bytes in Oracle DB because of the VARCHAR2 type. You can leverage this restriction by storing larger String in a Clob type.

For doing this, you only have to change de text type used in Spring configuration to map your field. Using the ClobStringType will tell Hibernate to look for a Clob in the database.

This method is very useful and solve the problem of reading and writing String larger than 4000 bytes in the DB. In fact, while the content of the field was small, there wasn’t any problem, but with a larger one, Hibernate was not able to store it into the DB. Even if I tryed to store it with JDBC to see what was the problem, Hibernate couldn’t retrieve the stored field. It clearly was a problem of mapping.

Code :

.: To Complete :.

Let’s suppose we have the basic following class Book in our datamodel :

public class Book
    private String summary;
    public String getSummary() {
        return summary;

    public void setSummary(String summary) {
        this.summary = summary;

In our configuration file for hibernate, we find :

<bean id="lobHandler" lazy-init="true"/>

<bean id="mySessionFactory">
 <property name="dataSource" ref="myDataSource"/>
  <property name="mappingLocations">
  <property name="hibernateProperties">
    <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
    <property name="lobHandler" ref="lobHandler"/>

The hibernate-mapping.hbm.xml gives us :

<class name=”Book” table=”book”>
<id name=”id” type=”integer” unsaved-value=”null”>
<param name=”sequence”>book_id_seq</param>

<property name=”summary” type=””/>

Install PostgreSQL on Ubuntu

We’re about to install the PostgreSQL database. You can either use the Synaptic Tool (you just have to select postgresql) or the old apt-get to download packages on Ubuntu. To install the client/server database, in Konsole, run :

$ sudo apt-get install postgresql postgresql-client postgresql-contrib

To configure PostgreSQL, you need to locat the pg_hba.conf. First, you have to launch the database in order to create this (and other) file. It’s made by doing :

$ sudo /etc/init.d/postgresql start

.: To Complete :.

More on

Active Life [ON]

Hired as a Software Engineer (J2EE, J2SE) yesterday, I decided to create this blog to share my “knowledge” (if I can say that ^^).

For my first day, I’ve heard the name of technologies such as Google Web Toolkit (GWT), Spring MVC, Hibernate, JSTL and also JIRA, IntelliJ IDEA, SmartSVN, …

It seems good ! Isn’t it ? 😀