Hibernate includes a total of 23 jar packs, dazzling. This article will explain in detail hibernate each jar package The function, is advantageous in the application according to own need to make the choice.
Download hibernate, such as 2.0.3 stable version, uncompressed, you can see a hibernate2.jar and a lib directory with 22 jar packages:
Hibernate2.jar:
Hibernate library, nothing to say, must use the jar pack
Cglib-asm.jar:
Cglib Library, Hibernate uses it to realize the dynamic generation of PO byte code, very core library, must use JAR package
Dom4j.jar:
DOM4J is a Java XML API, similar to Jdom, used to read and write XML files. Dom4j is a very, very good Java XML API with excellent performance, powerful features and extreme ease of use, and it is also an open-source software that can be found on SourceForge. The IBM Developerworks can find an article on the performance, functionality, and usability of the mainstream Java XML API, DOM4J is excellent in that regard. I started using dom4j nearly two years ago, until now. Now you can see that more and more Java software is using dom4j to read and write XML, and it is particularly worth mentioning that even Sun's JAXM is using DOM4J. This is the jar package that must be used, which hibernate use to read and write the configuration file.
Odmg.jar:
ODMG is an ORM specification, Hibernate implements the ODMG specification, which is a core library that must be used by the jar package.
Commons-collections.jar:
One of the Apache Commons packages contains some collection classes developed by Apache that are more powerful than java.util.*. The jar package that must be used.
Commons-beanutils.jar:
One of the Apache Commons packages that contains some Bean tool class classes. The jar package that must be used.
Commons-lang.jar:
One of the Apache Commons packages, which contains some data type tool classes, is an extension of the java.lang.*. The jar package that must be used.
Commons-logging.jar:
One of the Apache Commons packages that contains the log function and the jar package that must be used. The package itself contains a simple Logger, but the function is weak. In the run it will first find log4j in Classpath, if there is, the use of log4j, if not, to find JDK1.4 belt java.util.logging, if you can not find the use of simple Logger. The emergence of Commons-logging.jar is a historical legacy of regret, when Apache lobbied Sun log4j to join JDK1.4, but JDK1.4 project team has been close to the release of JDK1.4 product time, so rejected the Apache request, use their own Java Util.logging, the function of this package is far worse than log4j, and the performance is general.
Then Apache developed the Commons-logging.jar to be compatible with two logger. Therefore, the log program written with Commons-logging.jar, the bottom of the Logger can be switched, you can choose log4j,java.util.logging or its own simple Logger. However, I still strongly recommend using LOG4J, because log4j performance is very high, log output information time is almost equal to System.out, and processing a log on average only need 5us. You can find in the Hibernate src directory hibernate has been prepared for you log4j configuration files, you only need to go to the Apache website to download log4j on it. Commons-logging.jar is also a necessary jar package.
The necessary jar packages for Hibernate are the ones above, and the rest are optional.
Ant.jar:
The jar package for the Ant compilation tool to compile the hibernate source code. If you are not ready to modify and compile the Hibernate source code, then there is nothing to use, optional jar package
Optional.jar:
A helper package for Ant.
C3p0.jar:
C3PO is a database connection pool that hibernate can be configured to use C3PO connection pooling. If you're going to use this connection pool, you'll need this jar package.
Proxool.jar:
is also a connection pool, ditto.
Commons-pool.jar, Commons-dbcp.jar:
DBCP database Connection pool, Apache Jakarta organization developed, TOMCAT4 connection pool is also dbcp.
In fact, Hibernate has also implemented a very very simple database connection pool, plus the top 3, you can actually select 4 different database connection pools on the hibernate, choose which one to look at personal preferences, but dbcp may be more general. In addition, if you use Hibernate in EJB, be sure to use the connection pool of app server, do not use above 4 kinds of connection pool, otherwise container management transaction does not work.