In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to build a Hibernate conversation factory". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to build a Hibernate conversation factory".
Install Hibernate Annotation
To use Hibernate Annotation, you need at least Hibernate 3.2 and Java 5. You can download Hibernate 3.2 and the Hibernate Annotation library from the Hibernate site. In addition to the standard Hibernate JAR and dependencies, you also need Hibernate Annotations .jar files (hibernate-annotations.jar) and Java persistence API (lib/ejb3-persistence.jar). If you are using Maven, you only need to add the appropriate dependencies to the POM file, as follows:
... Org.hibernate hibernate 3.2.1.ga org.hibernate hibernate-annotations 3.2.0.ga javax.persistence persistence-api 1.0...
The next step is to get the Hibernate session factory. Although no dramatic changes are required, this work is different from using Hibernate Annotations. You need to use the AnnotationConfiguration class to establish a session factory:
SessionFactory = new AnnotationConfiguration () .buildSessionFactory ()
Although you typically use elements to declare persistence classes, you still need to declare persistence classes in the Hibernate configuration file (usually hibernate.cfg.xml):
Many recent Java projects use lightweight application frameworks, such as Spring. If you are using the Spring framework, you can easily set up an annotation-based Hibernate session factory using the AnnotationSessionFactoryBean class, as shown below:
Org.hibernate.dialect.DerbyDialect create... Com.onjava.modelplanes.domain.PlaneType com.onjava.modelplanes.domain.ModelPlane... Thank you for your reading, the above is the content of "how to establish a Hibernate session factory". After the study of this article, I believe you have a deeper understanding of how to establish a Hibernate session factory, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.