Java Reference
In-Depth Information
@ManyToOne(cascade={CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH},
fetch=FetchType.EAGER)
@JoinTable(name = "ArticleSection",
joinColumns = {
@JoinColumn(name="articleId", referencedColumnName="ID")},
inverseJoinColumns = { @JoinColumn(name="sectionId",
referencedColumnName="ID")})
public Section getSection() {
return section;
}
public void setSection(Section section) {
this.section = section;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
Creating a session bean
In this section, we shall create a wrapper session bean for the entity bean. In the
session bean, we shall add query methods corresponding to the named queries
defined in the entity beans. We shall add a method to create test data, and a method
to delete data. Also, we shall add remove methods to remove
Catalog
,
Edition
,
Section
, and
Article
entity instances. To create a session bean, select
File
|
New,
and in the
New
Gallery
window, select
Business Tier
|
EJB
in
Categories
and
Session Bean
in
Items
. Click on
OK
:
Search WWH ::
Custom Search