Primefaces technology is available at Shortname in this page 'PF'.

MinuteProject 4 Primefaces generates a primefaces presentation stack managing advanced CRUD operations:
  • Create
  • Update
  • Delete
  • Master-detail
  • Pagination, sort, order list
  • View entity associations
    • One to many via
      • drop-down list
      • SubUC
    • Many to one via collection tabs, where element can be added (created) or removed
    • Many to many via
      • collections tab where element can be associated (referenced) or dis-associated
      • picklist where multiple element can be associated (referenced) or dis-associated

It exists with 2 backend:
  • EJB only (BELA -Basic Enterprise Layer Architecture)
  • Spring only (BSLA - Basic Enterprise Layer Architecture)

Both backend are based on JPA2.

It will also indicate you how to customize your MinuteProject 4 JSF templates. The idea is to put best-of-breed templates.
MinuteProject 4 Primefaces is a lean process, and Minuteproject is looking forward to your feed-backs.

MP will be generated on top of your data model:
  • PF menu
  • Create xhtml
  • List xhtml
  • Controller beans
  • EJB3 bean handling with JPA2 layer
  • web.xml
  • beans.xml (empty but for CDI)
  • faces-config.xml (navigation flow, i18n resource declaration)
  • pom.xml for Front-end with PF integration
  • pom.xml global for JPA2 module and PF module.


One step is needed:
  1. The first 'Generation step' consists of configuring MP kernel either via a configuration file or via the console.


Have Java 6 setup.
Download MinuteProjectlast version.
Check that your database connection is available

Step: Generation

Via the console
  1. Start the MP console (<MP_HOME>/bin/start-console.(cmd/sh). How to use the console.
  2. Fill the connection information to the datamodel
  3. Fill the model general information (model, package names, version primary key policy, scope).
  4. Choose JSF-Primefaces target
  5. Click generate

Via the configuration file
An example can be found <MP_HOME>/demo/config/mp-config-JSF-EJB3.xml.
To run it: execute demo-JSF-primefaces.(cmd/sh)

Target Configuration used in mp-config-JSF-EJB3.xml

<!DOCTYPE root>
<generator-config xmlns=""
            <target-convention type="enable-updatable-code-feature" />
        <model name="petshop" version="1.0" package-root="">
                <driver groupId="org.apache.derby" artifactId="derby" version=""/>
                <fileSource name="petshop" dir="c:/MinuteProject/data">
<!--                     <url>jdbc:hsqldb:hsql://</url> -->
                <primaryKeyPolicy oneGlobal="true">
                    <primaryKeyPolicyPattern name="autoincrementPattern"/>
                    <condition type="exclude" startsWith="DUAL"></condition>
                    <condition type="exclude" startsWith="ID_GEN"></condition>
                    <condition type="exclude" startsWith="SEQUENCE"></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"/>
                      <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="Primefaces-JEE" />
        <!-- for the primefaces with spring version
                <target catalog-entry="Primefaces-Spring" />

Target Configuration explained
  • Node JPA2 means that MP will generate the associated JPA2 entities entities such as shipped in JPA2 track
  • Node LIB means that some reference are used (velocity lib) but there is nothing generated
  • Node JSF focuses on the core JSF presentation stack associated controller beans, maven integration
  • Node MavenMaster generates a master pom for JPA2 and JSF-primefaces tracks
  • Node documentation gives information relevant to the generation such as number of artifacts generated per template

The rest of the page will deal with the code generated from the demo application

Resulting artifacts

You can have the resulting source if you download

4 maven pom project structure are generated
  • One global for JPA2, BELA and JSF
  • One for JPA2 (see JPA2)
  • One for BELA
  • One for JSF (primefaces implementation) whose structure open as a maven eclipse project is the following



There is a little trick at this level which is only specific to this demo and may not be relevant for your generation.

Minuteproject is shipped with hsqldb sample db called petshop.
I have to use a JEE6 container (CDI working).
I've choosen glassfish.
Meanwhile I do not know how to configure correctly a connection pool for HSQLDB on glassfish.
Since I know how to do with Derby DB, I have to:
  1. Pass the petshop sql script on a derby instance (available in <MP_HOME>/sample/hsql/petshop.sql)
  2. Overwrite the persistence xml in /output/JSF/petshop/JPA2/src-overwritten/main/resources/META-INF
  3. Configure the appropriate Datasource here jdbc/petshopDS

persistence.xml to copy in /output/petshop/JPA2/src-overwritten/main/resources/META-INF
<?xml version="1.0"?>
<persistence xmlns=""
    <persistence-unit name="petshop" transaction-type="JTA">
        <!-- pet -->
        <!-- product -->
<!-- optional if you do not want to run the sql script
            <property name="eclipselink.ddl-generation" value="create-tables" />
The maven build script will overwrite to default by this one.

Remark: since the database upon with to run the app is no more hsqldb but derby, the primary key policy is autoincrement.

Suggestions to solve this issues are welcomed.



On /output/JSF/petshop run:
mvn package
It will create the
  • JPA2 backend
  • JSF front end

The result app war petshopApp.war is in /output/JSF/petshop/JSF/target.


Start glassfish
Check jdbc/petshopDS Datasource is configured.
Deploy App


Start your navigation at http://localhost:8080/petshopApp

Details screens here.

Main knowledge flows


Excellent tutorial

Primefaces example with pagination