At 2004-09-22 17:46
First, Hibernate is a lightweight object package for JDBC, which is a separate object persistent layer frame, and the App Server, and the EJB has no inevitable connection. Hibernate can be used in any case where any JDBC can be used, such as the database access code of the Java application, and the implementation class of the DAO interface, can even be the code of accessing the database inside BMP. In this sense, Hibernate and EB are not something in a category, nor does it exist. Second, hibernate is a framework closely associated with JDBC, so Hibernate's compatibility and JDBC driver, and databases have a certain relationship, but use its Java program, and APP Server does not have any relationship, and there is no compatibility problem. . Third, Hibernate can't be used to compare directly with Entity Beans, only in the framework of the J2EE project can be compared. And even if it is placed in the software overall frame, Hibernate is also an alternative to JDBC, rather than the alternatives of entity beans, let me listen to the frame structure of N times, I have listed N times: Traditional architecture : 1) Session bean <-> DB In order to solve the alternative architecture of performance barriers: 2) Session bean <-> DAO <-> JDBC <-> DB Using Hibernate to improve the development efficiency of the above architecture: 3) Session bean <-> DAO <-> Hibernate <-> DB is analyzed above 3 architectures: 1, memory consumption: Architecture 2 using JDBC 2 is undoubtedly the most survival, Hibernate architecture 3 times, EB Architecture 1 is the worst. 2, running efficiency: If the JDBC code is written very optimized, the JDBC architecture has the highest efficiency, but in the actual project, this is almost can't do. This requires the programmer very proficient in JDBC, use the BATCH statement, adjust the preapredstatement Batch size And the parameters such as FETCH Size, as well as the result set cache, etc. In general, the programmer can't do this. Therefore, the Hibernate architecture exhibits the fastest running efficiency. The architectural efficiency of EB is very far. 3, development efficiency: With JBuilder support and simple project, EB architecture has the highest efficiency, JDBC, Hibernate is the worst. However, in the case of large projects, especially the persistent layer relationship, Hibernate is highly efficient, and the EB architecture is likely to fail. 4, distributed, safety inspection, cluster, load balancing support because there is SB as Facade, three architectures have no difference. Fourth, where is EB and Hibernate learning difficulty? Where is the difficulty of EB? Not in a complex XML configuration file, but in the use of EB is slightly inadvertent, there is a serious performance barrier. So difficult to learn a lot of EJB design patterns to avoid performance issues, need to learn the configuration of App Server and EB to optimize EB's operating efficiency. Make EB development work, most of the programmers have been placed on the performance of EB, but there is no more energy attention to the mainstay of the object that is mainly investigated. Where is Hibernate? Not in Hibernate itself, in fact, Hibernate is very simple, it is difficult to be too flexible in Hibernate.
When you use EB to achieve a lasting layer, you will find that EB is really awkward. It's awkward. You don't have any rooms that you can choose, so you don't have to spend energy to design the design, to balance the plan. Getting to the feet to consider which solution, because only the only solution is in front of you, you can only do this, no choice. In contrast, it is too flexible, the same problem, you can at least design more than a dozen programs to solve, so special brings, use this, or use that? What is the difference between these programs? What is the difference between their operating principles? Which is better? The light is the primary key generation, there are seven or eight plans for you to choose, are you not difficult? Collecting attributes can be used, you can use List, you can use BAG, which is high in the end, is you not difficult? Query can be used with item, which is good, what is good, what is the difference? Are you not difficult? Composite primary key You can configure directly in HBM, or custom Customertype, which is better? Are you not difficult? For a table, you can choose a single map, or map into a parent-child object, you can also map into two 1: 1 objects, in what circumstances, which is better, are you not difficult? This list can be opened until you don't want to look back. When you have countless dazzling programs, will you feel happiness? Still sad? If you are a responsible programmer, then you will learn the differences in each program, the efficiency of each program, the applicable occasion of each program, you will feel that you can't pull it out. If you use EB, your first second has made a decision, it doesn't have to choose, such as collection attributes, you can only use collection, if it is hibernate, you will be hesitated back and forth between Bag, List and Set Decisive, even if it is unclear, there is no way to write. •
Small dish wes109, please come.
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-23 08:44
The EJB components are managed by EJB container, so who manage the Hibernate objects? In Framework 1, for BMP, the JDBC is wrapped by EJB container as DS, they are transparent to clients, now the Hibernate is going to replace JDBC, where I Deploy the to? I do appreciate your help.thanks.
• Google's [Translate this page Beta] !!!!!!!!!!!!!
Author RE: Hibernate [Re: Lummyliao] dengyin2000 Posting: 18 Points: 0 on 2004-09-23 09:00
He does not need a container Manage like a general container to Tomcat you can make a simple hibernate example.
• Eclipse Folding Plug-in
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-23 09:39
If you need Tomcat, that means the Hibernate objects still need container.I confused the Tomcat was used for holding Servlets, I just guess they do not manage Hibernate objects.For example, I have a table called "Test" with one colume: "COL1" DATATYPE IS "VARCHAR2 (100)". The Database IS in a Remote Node.currently I Have A Node, this is my EJB Container, I Have A Stateless Session Bean with Remote "Hello", and The Bean Class IS " Hellobean ". I need to import a business method named:" Public void Hello (String S) "INSIDE" Hellobean "and exposed to" Hello ", When Client Invoke 'Hello (" Hello World. ");', I Want To insert one row of data "Hello World." into the table "Test" My first question is:.? The Hibernate has hundreds classes, where I put those library classes If the EJB container have to know all the classes.My second question is : Iri I NEED JDBC Connection from Public Void Hello (String S) {// JDBC Needed Here To INSERT.} Object? Thanks. I Just Interested to Kno W HOW The LINKS Are Implement: 3) Session Bean <-> DAO <-> Hibernate <-> DB • Eclipse Folding plug-in
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-24 05:44
I Only Need The Idea Where To Find The Hibernate Objects from The Bean.thanks.
• US military soldier manual (what is thought to?)
Author RE: Hibernate [Re: Didongusa] Nothing I am waiting .. CJSDN Senior Member Posted: 1572 Points: 13 on 2004-09-24 06:53
Flexible things are not suitable for industrial production.
Best Regards, "But He Has Nothing on ........."
• Zhang Xiaoxiang java8 disc is good.
Author RE: Hibernate [RE: Lummyliao] Sankxuan Posting: 36 Points: 0 on 2004-09-24 09:33
The landlord reprints, please explain, Hibernate is obvious. If there is any problem, please see the Hibernate documentation, EJB3.0 is also a lot of hibernate. • Where do I have Java -api download?
Author RE: Hibernate [Re: lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-26 03:23
In the 3) Session Bean <-> DAO <-> Hibernate <-> dbWho is going to import the dao? Really need someone's help?
• Google's [Translate this page Beta] !!!!!!!!!!!!!
Author RE: Hibernate [Re: Didongusa] gispda posting: 22 Points: 1 on 2004-09-26 10:55
Didongusa Wrote: in the 3) session bean <-> DAO <-> hibernate <-> dbwho is going to import the dao? Really NEED SOMEOD?
Firstly, You'd better to bind a sessionfactory to your app server, then in your session Bean can get the sessionfactory, then you can put it in your dao.You dao can do all the CRUD operation.Session Bean's bussness method is your Dao's Caller.
• IBM is really cattle
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-26 12:31
Looks like you have to write some startup files to create the sessionfactory objects and bind them at the server startup.If shutdown and restart the server is impossible, how can you create and bind the object? Thanks.
• A child's pure heart - a child who is stunned by doctors [ZT]
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 on 2004-09-26 12:54
Using the "t3startupdef" to Trigger the binding at Startup Could Hurt The Portability, I Think this is no no No no no. Another Way? Thanks.
• A child's pure heart - a child who is stunned by doctors [ZT]
Author RE: Hibernate [Re: lummyliao] gispda Posting: 22 Points: 1 at 2004-09-27 10:18
Okay.Then You can use Spring with hibernate.
• Don't think that the installed is easy!
Author RE: Hibernate [Re: Lummyliao] Need for Speed Posting: 134 Points: 3 On 2004-09-27 14:06
Why do you speak English? Use Spring Hibernate.
• Where is Java --api download?
Author RE: Hibernate [Re: Lummyliao] Didongusa Posting: 61 Points: 0 On 2004-09-27 14: 16th Container IS Too Cold, You NEED A WARMER One? Hibernate Means "Sleep Inside the EJB Container"?
• Only 2% of people have answered this question
Author RE: Hibernate [RE: Lummyliao] Huzhigang Posting: 4 Points: 0 on 2004-09-28 08:52
Hibernate will be difficult to make you so difficult? I am surprised. In fact, the entity bean makes us difficult to choose. "This list can be opened, until you don't want to look back. When you put countless dazzling programs, will you think happiness? Is it sad? If you are a responsible programmer, then you It will definitely study the differences in each program, the efficiency of each program, the applicable occasion of each program, you will feel that you can't fall in and unplugged. If you use EB, your first second is already made. Decisive, there is no choice, such as collection attributes, you can only use collection, if you are hibernate, you will have no rules between Bag, List, and SET, or even unclear, there is no way to write. " Bag, List, SET selection is easy, or even one minute is not required. This is not good in different occasions, this is not good? On the contrary, the all-in-one way of EJB faces all the issues seems to make you don't have to choose, but also let you choose the right solution. What is the cost of the landlord is willing to wasting your three days? I believe you will like it instead of EJB.
• IBM is really cattle
Author RE: Hibernate [Re: lummyliao] HOLYLZ2004 Posting: 3 Points: 0 on 2004-09-30 17:19
What is DAO?
• MYECLIPSE 3.82 Chinese issues
Author RE: Hibernate [Re: Lummyliao] DLINT Posting: 10 Points: 0 on 2004-10-17 20:42
The Book "EXPERT One-One-One J2EE Developments" by rod johnson cover all the topics Above.david Linj2ee Consultant Melbourne
• Server software upgrade, activation JNI function
Author RE: Hibernate [Re: Lummyliao] jbwang Posting: 201 Points: 4 On 2004-10-18 22:58
Some things can't be said to be so absolute! Look at the problem in many ways.
Myj2ee.grow (); system.exit (0);
• Only 2% of people have answered this question
Author RE: Hibernate [Re: lummyliao] YCLC Posting: 22 Points: 0 on 2004-10-20 11:55
In fact, similar arguments have emerged in many ways, what is the difference between the arguments and discussions in Java and C ? A design model is inevitable with his existence, it is still not going to experience it for a long time ~~
• Server software upgrade, activation JNI function
Author RE: Hibernate [Re: Lummyliao] Findjob Posting: 19 Points: 0 on 2004-10-21 20:24
>> 2, running efficiency: If the JDBC code is written very optimized, the JDBC architecture has the highest efficiency but >> is in the actual project, this is almost unable to do, this requires the programmer very proficient in JDBC, use BATC language >> In order to adjust the parameters such as PreapRedStatement's Batch Size and Fetch Size, as well as the product set cache, etc. In general, the programmer can't do this. Therefore, >> Hibernate architecture exhibits the fastest running efficiency. The architectural efficiency of EB is very far. I don't understand why preparedStatement is high? PreparedStatement PSTMT = conn.preparedStatement (...); for (int i = 0; i Author RE: Hibernate [Re: lummyliao] Robbin Posting: 3 Points: 0 on 2004-10-22 17:14 大 言 不! You write a simple example to test the efficiency of 1000 data in two ways, you will understand how ridiculous you said now. • Small dishes WES109, please come in. Author RE: Hibernate [Re: lummyliao] Findjob Posting: 19 Points: 0 on 2004-10-22 17:51 I didn't tried me, I won't talk, I inserted 100,000, the gap between the two was only 3 seconds. Have you tried it? no. Have you seen the driver of MySQL JDBC, read it again. • Only 2% of people have answered this question Author RE: Hibernate [Re: Lummyliao] Findjob Posting: 19 Points: 0 on 2004-10-22 19:19 This is my test mysql4.0.18ntmysql-connector-java-3.1.4-beta-bin.jarwindow server 2003 code: import java.sql.connection; import java.sql.preparedStatement; import java.sql.statement; import java .sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import com.mysql.jdbc.Driver; public class BatchUpdateTest {private final static String CLEAR_DB = "truncate sales_rep"; private final static String INSERT_INTO_DB = " INSERT INTO SALES_REP VALUES (?,?,?) "; public final static void main (string [] args) {if (args.length! = 2) {system.out.println (" Usage: please enter two args) Return;} String type = args [0]; int Num = 0; try {num = integer.parseint (args [1], 10);} catch (numberformatexception Nume) {throw new illegalgumentException ("The Second Arg Must Be A Number ");} if (!" ("Update" .Equals (args [0]) || "updatebatch" .Equals (args [0]) || "updatestmt" .Equals (args [0]))) { Throw new IllegalarGumentexception ("The first arg must be 'update' or 'updateBatch' or 'updateStmt' ");} //DriverManager.setLogStream(System.out); Connection conn = null; try {new Driver (); Properties prop = new Properties (); prop.setProperty ("User", "root"); Prop.SetProperty ("useunicode", "true"); Prop.SetProperty, "GB2312"); conn = drivermanager.getConnection ("JDBC: mysql: // localhost : 3306 / test ", prop); if (args [0]. Equals (" Update ")) Update (conn, num); Else IF (args [0] .Equals (" UpdateBatch " )) {updatebatch (conn, num);} else {updatestMT (CONN, NUM);}} catch (sqlexception sqle) {sqle.printStackTrace ();} finally {try {if (conn! = null) conn.close );} catch (SQLException sqle) {System.err.println (sqle.toString ());}}} private static void update (Connection conn, int num) throws SQLException {PreparedStatement pstmt = conn.prepareStatement (CLEAR_DB); pstmt (); pstmt.close (); pstmt = conn.preparestatement (INSERT_INTO_DB); Long StartTime = System.currentTimeMillis (); for (int i = 0; i System.currentTimeMillis (); stringbuffer buffer = new stringbuffer (num * 20); buffer.append ("INSERT INTO SALES_REP VALUES); for (int i = 0; i • Idea 4.5.3 has been released. Author RE: Hibernate [Re: Lummyliao] Findjob Posting: 19 Points: 0 on 2004-10-22 19:31 10,000 • "Flashpaper" converts Word files to Flash Author RE: Hibernate [Re: lummyliao] Findjob Posting: 19 Points: 0 on 2004-10-22 19:46 Robbin, is it Robbin on hibernate.org.cn, I know that you are very proficient in hibernate, you are a cattle. But this time you are absolutely wrong. If used by MySQL.