Hibernate

adplus-dvertising
Sequence Generator
Previous Home Next

It uses the sequence of the database. if there is no sequence defined, it creates a sequence automatically e.g. in case of Oracle database, it creates a sequence named HIBERNATE_SEQUENCE. In case of Oracle, DB2, SAP DB, Postgre SQL or McKoi, it uses sequence but it uses generator in interbase. Syntax:


.....  
 <id ...>  
  <generator class="sequence"></generator>  
 </id>  
 .....  

For defining your own sequence, use the param subelement of generator.


.....  
 <id ...>  
  <generator class="sequence">  
      <param name="sequence">your_sequence_name</param>  
  </generator>  
 </id>  
 .....

Previous Home Next