cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <giac...@apache.org>
Subject Hibernat2 block
Date Sat, 19 Apr 2003 09:31:06 GMT

Hi team

We've recently started a project that uses the Hibernat2 package from
http://hibernate.sf.net as a object to relational mapping tool. We considered
other packages and end up with Hibernate2 because of:

  - has good performance
  - has quite a good community
  - has many project using it (http://hibernate.bluemars.net/27.html)
  - has XDoclet support
    (http://xdoclet.sourceforge.net/tags/hibernate-tags.html)

and some other aspects.

We have developped a logicsheet that is a mixture out of the esql and jpath
logicsheets that let you develop easily XSP pages with hibernated content.

Consider the following object model:

  Project
   !
   +--<>* Task                Staff
           !                   !
           +--<>* Mandate *<>--+
                   !
                   +--<>* Expenditure <!--+
                                          !
                                +---------+---------+
                                !                   !
                              Activity            Expense

Where
  - Project     : Defines a project
  - Task        : Defines a task of a project
  - Mandate     : Defines a task worked on by a staff
  - Expendituere: Defines work activities as either
    - Activity  : Duration activity worked on a mandate
    - Expense   : Costs raised for a mandate

Now using the logicsheet one can build a XSP page like:

  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:hbn="http://otego.com/xsp/hibernate/2.0" >
   <document>
    <hbn:execute-query>
    <hbn:query>from project in class Project</hbn:query>
     <hbn:results>
      <project>
       <name><hbn:value-of select="result/name"/></name>
       <hbn:for-each select="result/tasks">
        <task>
         <name><hbn:value-of select="name"/></name>
          <hbn:for-each select="mandates">
           <mandate>
            <staff>
             <name><hbn:value-of select="staff/name"/></name>
            </staff>
            <hbn:for-each select="expenditures">
             <expenditure>
              <date><hbn:value-of select="date"/></date>
              <description><hbn:value-of select="description"/></description>
              <hbn:choose>
               <hbn:when test="type='Activity'">
                <activity>
                 <duration><hbn:value-of select="duration"/></duration>
                </activity>
               </hbn:when>
               <hbn:when test="type='Expense'">
                <expense>
                 <amount><hbn:value-of select="amount"/></amount>
                </expense>
               </hbn:when>
              </hbn:choose>
             </expenditure>
            </hbn:for-each>
           <sum><hbn:value-of select="sumAmountOfAllExpenditure"/></sum>
           </mandate>
          </hbn:for-each>
          <sum><hbn:value-of select="sumAmountOfAllExpenditure"/></sum>
         </task>
        </hbn:for-each>
       <sum><hbn:value-of select="sumAmountOfAllExpenditure"/></sum>
      </project>
     </hbn:results>
     <hbn:no-results>
      <project/>
     </hbn:no-results>
     <hbn:error-results>
      <trace>
       <hbn:get-stacktrace/>
      </trace>
     </hbn:error-results>
    </hbn:execute-query>
   </document>
  </xsp:page>

Anybody intressted in this? Can I donnate and add a block for it?

Giacomo

Mime
View raw message