Java Reference
In-Depth Information
In the Edition entity replace:
@ManyToMany(cascade =
{ CascadeType.MERGE, CascadeType.PERSIST,
CascadeType.REFRESH },
mappedBy = "editions")
@ManyToMany(cascade =
{ CascadeType.MERGE, CascadeType.PERSIST,
CascadeType.REFRESH },
mappedBy = "editions", fetch = FetchType.EAGER)
In the Edition entity replace:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "edition")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "edition",
fetch = FetchType.EAGER)
In the Section entity replace:
@OneToMany(cascade={CascadeType.ALL},mappedBy = "section")
mappedBy = "section",fetch=FetchType.EAGER)
Also, modify the EJB3Client.jsp . Instead of just listing all the entities, list the
contained entities. For example, retrieve all the editions in a catalog with the
getCatalogEditions() method:
List<Edition> editions=beanRemote.getCatalogEditions(catalog);
Similarly, retrieve all the sections in an edition with the EditionSections method
and all the articles in a section with the getSectionArticles() method. The
modified EJB3Client.jsp is listed next:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<%@ page import="model.*,java.util.*,javax.naming.*"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<meta http-equiv="Content-Type"
Search WWH ::

Custom Search