问题
Aftre migrate my application from hibernate 4 to hibernate 5 .my sequence dose not work and hibernate use our default sequence instead of my sequence .my mapping config in hbm like this my database is oracle .
<id name="id" column="Id" type="java.lang.Long">
<generator class="sequence" >
<param name="sequence">SEQ_APP_Login_Log</param>
</generator>
</id>
after google some people say change class to org.hibernate.id.enhanced.SequenceStyleGenerator but dose not work again.
回答1:
It's simple. The sequence
attribute has changed to sequence_name
:
<id name="id" column="Id" type="java.lang.Long">
<generator class="sequence" >
<param name="sequence_name">SEQ_APP_Login_Log</param>
</generator>
</id>
来源:https://stackoverflow.com/questions/42191210/why-does-hibernate-5-sequence-generator-use-the-default-hibernate-seq-instead-of