In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Configuration configuration = new Configuration ()
Create an object that loads the configuration file
Configuration.configure ()
1. Load configuration file hibernate.cfg.xml
2.hibernate.cfg.xml
1. Information describing the links to the database
2. Load the mapping file * .hbm.xml
SessionFactory = configuration.buildSessionFactory ()
1. Hibernate integrates the link information of the database, the information of the mapping file and the information of the persistence class.
2. SessionFactory is generated by singleton mode.
3. In general, a hibernate should have a database link
4. The class itself is thread-safe
SessionFactory.openSession ()
Opened a link to the database, ready to operate the database
1. Query
2.CUD operation
Open a transaction
Session.beginTransaction ()
Perform the operation of cud
Note:
1. Whether a class is persistent
1. Load the configuration file
2. Load the mapping file in the configuration file
3. Parse the name attribute of the class element in the mapping file and find the corresponding class
2. The class of the parameters on the client must be a persistent class
3. Use the session.get method to generate an object that calls the default constructor, so there must be a default constructor in a persistent class
4. In hibernate, this is not allowed: two persistent objects, but the value of the identifier is the same
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.