Hibernate technology

xiaoxiao2021-03-06  58

First, the preface is just the technique of Java's database level, it is a JDBC, and the subsequent project is getting bigger and bigger. I feel that JDBC is connected everywhere, or uses a direct SQL statement, modification or project change is very inconvenient. So I plan to write a program based on JDBC-based procedural, all access is converted to JDBC code through this program. ClientDbaccessJDBCDBClient's adoption of this technology has brought very changed to development work. All the operations of the database becomes the operation of an object. I use the Java language-specific Reflection mechanism, dynamically get a Javabean Attribute, then corresponding to a list of a database, this, the client's code is very simple, for example: dbaccess dba = new dbaccess (); foo f = new foo (); f.setbar (abar) ; ... // setting property for class foodba.insert; can complete the operation inserted into the database as long as you have a simple step. In fact, I am here to assume some settings, such as most Java types such as int, long, double, string, I all mapping became the String type of the database, and in order to know the Table name corresponding to a JavaBean, and the name of the primary key, I specially This information is recorded in JavaBean. Since there is no XML technology to configure this information, I have made my project management is very troublesome. Hibernate, it is actually an O / R mapping tool, which uses XML technology, Java Reflection technology, etc., and the basic principle I think I feel similar to the classes I do. Analysis of Alternative O / R Mapping Tools ---- Hibernate is a comparative alternative thing, because the current industry quarrel is a JDO technology, JDO seems to be a standard, JBoss has also a Dok, everyone All are striving to become a factual standard, but in another foreign domain in the world, some program masters have silently maintained Hibernate technology. Hibernate technology is also compliant with ODMG standards, and its outstanding derived from continuous upgrades, continuous maintenance, modifications. And the perfect document, the popular forum is very popular. It is also important to have its easy-to-use ease of use. Here I will give a relatively shallow example, which is equivalent to the HelloWorld program we know. But this first step is also very important. Second, download and install HibernateHibernate is a subpress from SourceForge, search for Hibernate from Google You can search all connections for Hibernate. Specifically, you can get the downloaded connection from http://hibernate.sourceforge.net, the latest Release version is Hibernate 2.0.1 (2003-6-17), of course, you can also get the source code from the CVS , Then compile it by yourself. Third, Hibernate Basic Concepts Hibernate technology is essentially a middleware that provides database services. Its architecture is shown below: This figure shows the working principle of Hibernate, which uses the database and other configuration files such as hibernate.properties, XML mapping, etc. to provide data lasting service for the application. Its API contains the following major classes.

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

New Post(0)