EJB Learning (vi) Comparison of--entity Bean and Hibernate

Source: Internet
Author: User

In learning EJB entity Bean this piece of time, feel it and hibernate is the same, the original summary of the map of hibernate to find out, after comparison, feel two is almost bad good, The following is an understanding of the EJB's entity Bean based on hibernate.


We compare the entity bean to hibernate with the above guide:


Global configuration file in 1.Hibernate hibernate.cfg.xml and Persistence.xml in Entity Bean

Hibernate hibernate.cfg.xml: This section primarily records the necessary information for connecting to a database, such as database drivers, database names, usernames and passwords, and the dialect configuration that hibernate needs to access different databases. Another part is the introduction of the Xxx.hbm.xml file.

Persistence.xml: Specifies the default behavior of the data source and Entitymanager object used by the entity Bean. The default behavior of the Entitymanager object here is that it is time to configure the DDL generation strategy, and unlike above,there are no xxx.hbm.xml files for each entity in Persistence.xml .


"Entity + entity. Hbm.xml" in 2.Hibernate and "entity class" in the entity beanIn hibernate, mapping an entity to a database requires " entity. Hbm.xml", whereas in the entity Bean, the entity is mapped to a database by annotations, and the corresponding label is on the class and on the class's properties.
Entitymanager in session and entity beans in 3.Hibernatein hibernate, the change of the data is realized by the session, while in the entity bean, the change of the entities is done by Entitymanager, that is, the persistent entity manager. And their operations on entities are almost the same except for names.  
Summary:
In fact, by looking at the data, the 3.0 EJB Entitybean API call translates to an internal Hibernate3 own API to achieve EJB3.0 Entitybean compatibility. By comparing to learn, can better grasp the similarities and differences between them.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

EJB Learning (vi) Comparison of--entity Bean and Hibernate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.