Liferay is a opensource portal enabling admin to deploy portlets.
Portlets can be generated by minuteproject on the following tracks
  • openxava
  • primefaces (portlet in 0.8.5)
  • vaadin (portlet in 0.8.5)

Liferay proposes also a tool called Service Builder that speed-up portlet creation by generating backend service artifacts (match spring and hibernate technologies).
It works based on an input configuration file called service.xml holding the definition of the persistence unit. It looks like a light ORM definition enriched by Liferay and development facility information. The input file is then processed by a ant task to generate the Liferay compliant artifacts.
The input promotes a Domain-Driven-Approach.

The study shows the feasibility to generate the input file service.xml
MinuteProject 4 Liferay will generate the service builder info using smart reverse-engineering for table and view objects.


This track provides a service.xml artifacts to operate with Liferay-plugin and service builder generation.
For certain model you may face service-builder/liferay-plugin limitations (cyclic reference, big model)


Since Minuteproject generated artifacts are dependent on Liferay. Liferay infrastructure has to be set-up.
  • Liferay server
  • Liferay SDK
  • Liferay IDE (eclipse distrib + Liferay plugin)

Minuteproject Configuration

To use minuteproject 4 liferay track, just add the value 'Liferay' to the attribute catalog-entry' in the node 'targets'

     <targets catalog-entry="Liferay" />


File mp-config-liferay.xml
<!DOCTYPE root>
<generator-config xmlns=""
        <model name="petshop" version="1.0" package-root="">
                <driver name="hsqldb" version="" groupId="hsqldb" artifactId="hsqldb"></driver>
                <fileSource name="petshop" dir="c:/MinuteProject/data">
                     <url>jdbc:hsqldb:hsql://</url> -->
                <!-- for Oracle and DB2 please set the schema
                <schema> </schema>
                <primaryKeyPolicy oneGlobal="true" oneForEachTable="false">
                    <primaryKeyPolicyPattern name="sequencePattern" sequenceName="hibernate_sequence"/>
                    <condition type="exclude" startsWith="DUAL"></condition>
                     <condition type="exclude" endsWith="_GEN"></condition>
                <business-package default="pet">
                    <condition type="package" startsWith="PRODUCT" result="product"></condition>
                    <condition type="package" startsWith="ITEM" result="product"></condition>
                      <entity-naming-convention type="apply-strip-table-name-prefix" pattern-to-strip="SYS,FIN"/>
                      <column-naming-convention type="apply-fix-primary-key-column-name-when-no-ambiguity" default-value="ID"/>
                      <reference-naming-convention type="apply-referenced-alias-when-no-ambiguity" is-to-plurialize="true"></reference-naming-convention>
                    <package name="product">
                        <entity-group entities="PRODUCT"></entity-group>
                        <entity-group entities="ITEM"></entity-group>
                    <entity name="PRODUCT" alias="MY_GOOD_PRODUCT">
                    <entity name="ITEM" alias="MY_GOOD_ITEM" comment="my item table">
                        <field name="PRODUCTID" alias="THIS_IS_MY_PRODUCT" comment="my product field reference"></field>
                    <entity name="CATEGORY" content-type="reference-data" >
                         <sql-path path="NAME"/>
         <targets catalog-entry="Liferay" >

//TODO explanation


cmd line
model-generation mp-config-liferay.xml

The ouput goes to ../output/liferay/petshop

If you have a liferay project and want the service.xml to goes straight into your Liferay project add outputdir-root attribute to not targets

     <targets catalog-entry="Liferay" outputdir-root="$pathToyourLiferayProject" />

Output Results

Place the resulting service.xml file into your liferay project (WEB-INF dir) and open it.

Service builder main view

On petshop DB, notice
  • Many to Many table Tag_Item is not present
  • Table names in DB can differ from your entity name (ex: Item -> MyGoodItem via enrichment)

Field mapping

  • simple field, DB column name can differ from Entity attribute (ex: ITEM.ITEM_ID ->
  • foreign key
  • reference gives collections


Primary key strategy

Couple of strategies are available
  • natural
  • uuid
  • sequence
  • autoincrement
  • identity



Some finders can be deduced by enrichment, via the semantic reference of the entity. Ex name for category



Liferay service builder plugin can generate/compile/package your service.