native generator class in hibernate

后端 未结 2 793
走了就别回头了
走了就别回头了 2020-12-20 12:55

I have this part of hibernate mapping xml file, and I was looking for a good example for what does native mean.


 

        
2条回答
  •  生来不讨喜
    2020-12-20 13:35

    Native means Your generator will use identity or sequence columns according to what your current database support.

    Docs explained about each strategy here

    http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/mapping.html#mapping-declaration-id

    native

    selects identity, sequence or hilo depending upon the capabilities of the underlying database.

    assigned

    lets the application assign an identifier to the object before save() is called. This is the default strategy if no element is specified.

    For example: In Mysql if you have primary key column as a auto_increment, the db will be updated using this strategy

提交回复
热议问题