Hibernate JAR package description

xiaoxiao2021-03-06  191

Hibernate includes 23 JAR bags, dazzling. This article will explain in detail the role of Hibernate every JAR package, which is convenient for you to pay according to your needs in your application.

Download Hibernate, for example 2.0.3 stable version, decompression, you can see 22 JAR packages in a hibernate2.jar and lib directory:

Hibernate2.jar:

Hibernate's library, there is nothing to say, the JAR package that must be used

CGLIB-asm.jar:

CGLIB library, Hibernate uses it to realize the dynamic generation of PO bytecodes, very core libraries, JAR packs that must be used

Dom4j.jar:

DOM4J is a Java XML API, similar to JDOM, used to read and write XML files. Dom4j is a very very excellent Java XML API with features that have excellent performance, powerful and extremely easy to use, and it is also an open source software that can be found on the SourceForge. An article can be found on IBM DeveloperWorks, and the performance, functionality, and ease of use of mainstream Java XML APIs, DOM4J is very excellent in that way. I started using DOM4J as early as nearly two years until now. Now you can see that more and more Java software is using DOM4J to read and write XML, especially worth mentioning that Sun's JAXM is also using DOM4J. This is the JAR package that must be used, Hibernate uses it to read the configuration file.

Odmg.jar:

Odmg is an ORM specification, Hibernate implements an ODMG specification, which is a core library that must be used.

Commons-collections.jar:

One of the Apache Commons package contains some collection classes developed by Apache, which is powerful than java.util. *. The JAR package that must be used.

Commons-beanutils.jar:

One of the Apache Commons package contains some Bean tool classes. The JAR package that must be used.

Commons-lang.jar:

One of the Apache CommONS package contains some data type tool classes, which is an extension of java.lang. *. The JAR package that must be used.

Commons-logging.jar:

One of the Apache Commons package contains log capabilities, and the JAR package that must be used. This package itself contains a Simple Logger, but the function is weak. When you run, it will look at the log4j in ClassPath. If there is, use log4j, if not, find java.util.logging with JDK1.4, if you can't find Simple Logger. Commons-logging.jar's appearance is a regret of a history. At the beginning, Apache strongly lobbyed SUN to join the log4j to JDK1.4, however JDK1.4 project team has been close to the time of the release JDK1.4 product, so rejection Apache Requirements, using their own java.util.logging, this package is far from log4j, and performance is also general. Later, Apache was developed comMMons-logging.jar used to compatible with two loggers. So use the log program written by Commons-Logging.jar, the bottom layer Logger can be switched, you can choose Log4j, java.util.logging, or the Simple Logger itself. However, I still recommend the use of log4j because log4j performance is high, and the log output time is almost equal to System.out, and a LOG is handled only 5us. You can find Hibernate's Log4j configured for you in Hibernate's SRC directory, you only need to go to the Apache website to download log4j. Commons-logging.jar is also a must-have JAR package. The JAR package that uses Hibernate must be the above, and the remaining is optional.

Ant.jar:

The JAR package of the ANT compilation tool is used to compile the hibernate source code. If you are not prepared to modify and compile the hibernate source code, then there is no use, optional JAR package

Optional.jar:

A auxiliary package of Ant.

C3p0.jar:

C3PO is a database connection pool, and Hibernate can be configured to use a C3PO connection pool. If you are ready to use this connection pool, you need this JAR package.

Proxool.jar:

It is also a connection pool, homingly.

Commons-pool.jar, commons-dbcp.jar:

DBCP database connection pool, Apache's Jakarta organization developed, Tomcat4's connection pool is also DBCP.

In fact, Hibernate also implements a very very simple database connection pool, plus 3 above, you can actually select 4 different database connection pools on Hibernate, choose which one looks better, but DBCP may be more Universal. Also emphasizes that if you use Hibernate in EJB, you must use the APP Server connection pool, do not use the above 4 connection pools, otherwise the container management transaction does not work.

CONNECTOR.JAR:

JCA specification, if you configure Hibernate as Connector on App Server, you need this JAR. However, in fact, the App Server will definitely bring this package, so it is actually a redundant package.

Jaas.jar:

JaaS is used to perform permission verification, which is already included in JDK1.4. So actually a redundant package.

JCS.jar:

If you are ready to use JCS in Hibernate, you must include it, otherwise it will not be used.

JDBC2_0-stdext.jar:

JDBC2.0 extension package, generally the database connection pool will be used. However, App Server will bring it on, so it is excessive. Jta.jar:

JTA specification, when Hibernate is needed, but App Server will bring it, so it is excessive.

JUnit.jar:

JUnit Package, when you run the test code comes with Hibernate, it will not be used.

Xalan.jar, Xerces.jar, XML-Apis.jar:

XERCES is an XML parser, Xalan is a formatter, and XML-APIS is actually JAXP. General App Server will bring, JDK1.4 also contains the analyzer, but not Xerces, crimson, poor efficiency, but hibernate is just reading the configuration file, the performance is not critical, so it is extra.

转载请注明原文地址:https://www.9cbs.com/read-128484.html

New Post(0)