本文介绍了休眠 ID 生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道一些关于如何为休眠创建自定义 ID 生成器的好教程吗?
Anyone know of some good tutorials on how to create a custom ID generator for hibernate?
推荐答案
在 Google 上粗略搜索hibernate custom id generator tutorial"发现了以下可能性.我已经排除了那些看起来没有用的并总结了每个的内容.
A cursory search of Google for 'hibernate custom id generator tutorial' turned up the following possibilities. I've excluded those that don't look useful and summarized the content of each.
- http://www.devx.com/Java/Article/30396- 涵盖了在数据持久化之前生成 ID(因此还没有业务密钥)的问题.
- http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#mapping-declaration - 整个文档非常有用,但与其说是教程,不如说是参考.查看其他教程时的理想选择.
- http://www.javaworld.com/javaworld/jw-08-2008/jw-08-hibernate-annotations.html 展示了如何使用注释来设置您的架构(包括自动生成的值).
- http://www.devx.com/Java/Article/30396 - covers the issues of generating an ID before the data is persisted (and hence does not yet have a business key).
- http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#mapping-declaration - the whole document is very useful but not so much a tutorial as reference. Ideal when looking at the other tutorials.
- http://www.javaworld.com/javaworld/jw-08-2008/jw-08-hibernate-annotations.html shows how to use annotations to set up your schema (including auto-generated values).
希望有所帮助.
这篇关于休眠 ID 生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!