Simplify EJB development using EJB3.O (3)

Source: Internet
Author: User

Simplify persistent Container Management
CMP Entity bean will become a major check method that is enforced by developers by EJB3.0. The persistence framework is like OracleAS TopLink. Open-source Hibernate has become a popular method for developing J2EE persistence framework applications that are not as complex and heavyweight as entity beans.
EJB3.0 adopts lightweight persistence modes such as TopLink and Hibernate to simplify container persistence management, which sounds more appealing to developers. Let's take a brief look at the Entity bean program. We will discuss the persistence improvement details in another article.
As POJOs, the Entity bean does not require component interfaces. The entity bean now looks like a pure object that supports inheritance and polymorphism.
The following is the source code of the object bean.
@ Entity public class Employee {
Private Long empNo;
Private String empName;
Private Address address;
Private Hashmap projects = new Hashmap ();
Private Double salary;
@ Id (generate = SEQUENCE) public Long getEmpNo (){
Return empNo;
}
Protected void setEmpNo (Long empNo ){
This. empNo = empNo;
}
Public String getEmpName (){
Return EmpName;
}
Public void setEmpName (String EmpName ){
This. EmpName = EmpName;
}
@ Dependent public Address getAddress (){
Return address;
}
Public void setAddress (Address address ){
This. address = address;
}
Public Set getProjects (){
Return projects;
}
Public void setProjects (Set projects ){
This. projects = projects;
}
Public Double getSalary (){
Return salary;
}
Public void setSalary (Double salary ){
This. salary = salary;
}
....
}
If you carefully read the code, you can find that the bean class in the current object bean is a specific class instead of an abstract class.
Multiple improvements have been made to the SQL query of EJB QL and object beans. The new entity management API similar to Hibernate and the simplified TopLink session API are recommended for Processing Entity bean operations, that is, object bean creation, release, and search.

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.