In case we do not pass any of these parameters then default parameters will be picked up as per default data maintained. There are max three parameters which can be passed as a parameter to this class. The first value will be 1 and other subsequent values will be incremented by 32767 as per algorithm’s logic. It generates a unique key using a high and low algorithm for short, long, and int type. This comes under the TableHiloGenerator class. In this case, hibernate will not generate the primary key and so no parameters for this class to be passed. This is used to support the “id” column which is generated internally by database only by calling the auto-incremented column algorithm of respective database. This generator is database dependent and used only in Sybase, My SQL, MS SQL Server, DB2, and HypersonicSQL databases. This generator class is used in all databases except MySQL. In case the programmer has created its own sequence instead of picking up directly from the database then he can pass his sequence’s name as a parameter name in the generator class. Since these sequences are already defined in databases like oracle, DB2, SAP DB, Postgre, etc this generator becomes database dependent. This class is used to create a primary key using sequences from the database. In case we manually try to assign value to the primary key in database with this generator class implemented then the manual entry is ignored and only the value assigned using the formula of “increment” generator is used. It can be used in any database making this class as database independent. If a table already has an identifies then it considers its maximum value otherwise it considers first generated identifies as “1” and then keeps on adding one to the previous identifier. It is used to generator unique vale of int, short or long type. instead of above default generator tag.
0 Comments
Leave a Reply. |