org.openxava.calculators
Class IdentityCalculator

java.lang.Object
  extended by org.openxava.calculators.IdentityCalculator
All Implemented Interfaces:
java.io.Serializable, ICalculator, IHibernateIdGeneratorCalculator

public class IdentityCalculator
extends java.lang.Object
implements IHibernateIdGeneratorCalculator

To use identity database id generation.

An example of use:

  <property name="id" key="true" type="int" hidden="true">
                <default-value-calculator class="org.openxava.calculators.IdentityCalculator" on-create="true"/>
        </property>
  
It does not work with EJB2. It works with Hibernate and EJB3 JPA.

Author:
Javier Paniza
See Also:
Serialized Form

Constructor Summary
IdentityCalculator()
           
 
Method Summary
 java.lang.Object calculate()
           
 java.lang.String hbmGeneratorCode()
          Returns the xml code to insert inside 'id' element in .hbml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityCalculator

public IdentityCalculator()
Method Detail

hbmGeneratorCode

public java.lang.String hbmGeneratorCode()
Description copied from interface: IHibernateIdGeneratorCalculator
Returns the xml code to insert inside 'id' element in .hbml file.

Specified by:
hbmGeneratorCode in interface IHibernateIdGeneratorCalculator

calculate

public java.lang.Object calculate()
                           throws java.lang.Exception
Specified by:
calculate in interface ICalculator
Throws:
java.lang.Exception