Is it possible to use a generator for any <property> in a Hibernate mapping?

<id name="message_id" column="message_id">
   <generator class="native"/>
</id>

Above a typical example of using a generator for an ID column, I need an auto-generating column in my project, but not an ID.

+3
source share
1 answer

Hibernate has the concept of generated properties , although it can only be used when values ​​are generated on the database side, that is, it is equivalent <generator class = "identity" />, other generators cannot be used:

<property name = "message_id" generated = "insert" />
+3
source

Source: https://habr.com/ru/post/1785778/


All Articles