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