Why does Hibernate 5 sequence generator use the default hibernate.seq instead of my sequence?

做~自己de王妃 提交于 2019-12-12 11:17:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!