hibernate

来源:互联网 发布:如何找到淘宝上的假货 编辑:程序博客网 时间:2024/06/04 01:25

https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/index.html
http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html_single/
http://docs.jboss.org/hibernate/orm/5.1/userguide/html_single/Hibernate_User_Guide.html

Configurations
https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html
http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html_single/

hibernate.properties VS hibernate.cfg.xml
Hibernate的配置文件有两种形式:一种是XML格式的文件,一种是properties属性文件。XML格式的配置文件中,除了基本的Hibernate配置信息,还可以指定具体的持久化类的映射文件,这可以避免将持久化类的配置文件硬编码在程序中。XML格式的配置文件的默认文件名为hibernate.cfg.xml。位置:src/hibernate.cfg.xml。properties形式的配置文件默认文件名是hibernate.properties,在配置文件中包含了一系列属性的配置,Hibernate将根据这些属性来连接数据库。位置:src/hibernate.properties。properties形式的配置文件和XML格式的配置文件可以同时使用。当同时使用两种类型的配置文件时,XML配置文件中的设置会覆盖properties配置文件的相同的属性。在Hibernate发布包的etc路径下,提供了一个hibernate.properties文件,该文件列出了Hibernate 的所有属性。使用etc路径下的hibernate.properties文件作为配置文件的模板,修改此模板文件作为Hibernate配置文件,这种方式的确是快速进入Hibernate开发的方法。但是对于实际开发,通常会使用hibernate.cfg.xml文件作为配置文件。

SessionFactory
Why use only one SessionFactory Object per application?
What is Hibernate SessionFactory?
Reasons why Hibernate’s sessionFactory is thread safe
SessionFactory is Hibernates concept of a single datastore and is threadsafe so that many threads can access it concurrently and request for sessions and immutable cache of compiled mappings for a single database. A SessionFactory is usually only built once at startup. SessionFactory should be wrapped in some kind of singleton so that it can be easily accessed in an application code.

Session
openSession VS getCurrentSession
http://stackoverflow.com/questions/8046662/hibernate-opensession-vs-getcurrentsession
http://myjourneyonjava.blogspot.com/2013/12/difference-between-opensession-and.html

What is session in hibernate
http://www.tutorialspoint.com/hibernate/hibernate_sessions.htm

transient | persistent | detached
http://stackoverflow.com/questions/2573739/what-are-detached-persistance-and-transient-object-in-hibernate
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html

My favourite hibernate interview questions with answers?
http://www.javalobby.org/java/forums/t104442.html

0 0