hibernate一些概念的理解(未完待续)

[size=large]hibernate.hbm2ddl.auto = create.
Usually you only leave it turned on in continuous unit testing, but another run of hbm2ddl would drop everything you have stored - the create configuration setting actually translates into "drop all tables from the schema, then re-create all tables, when the SessionFactory is build".
可以看到它是删除再重建,我以前理解的是没有则重建,有则清空,看来是不对的。
[/size]

[size=large]
We recommend you declare consistently-named identifier properties on persistent classes. We further recommend that you use a nullable (ie. non-primitive) type.
为什么推荐我们不要设置基本类型那?不懂。。。。。。看来还需要高手的解释,特别是读过源码的人。。。。。。。。
[/size]
[size=large]
Properties need not be declared public - Hibernate can persist a property with a default, protected or private get / set pair.
这个得益于java提供强大的反射功能。
[/size]
[size=x-large]
Hibernate will always look for the DTD in its classpath first. If you experience lookups of the DTD using an Internet connection, check your DTD declaration against the contents of your claspath.
[/size]
[size=x-large]我当时还比较担心,他会不会到网上去查找DTD文件,因为本地都有了,现在看来我是彻底错了。[/size]

[size=large]It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing classes of that interface using the <subclass> element. You may persist any static inner class. [/size]
[size=large]我们经常提到hibernate提供了很好的POJO映射支持,当时我还因为它只支持POJO,现在看来我错了,但是如果因为接口和内部静态类的话,可能又增加了复杂性。[/size]

[size=x-large]The access attribute lets you control how Hibernate will access the property at runtime. By default, Hibernate will call the property get/set pair. If you specify access="field", Hibernate will bypass the get/set pair and access the field directly, using reflection.[/size]
[size=x-large]如果我们设置了access="field",那么hibernate的直接使用反射来访问这个属性,个人感觉反射破坏了封装,但作为工具的话这么做还可以。[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值