Java Reference
In-Depth Information
ArrayList<Section> sections = new ArrayList<Section>();
Query q = em.createNamedQuery("findSectionAll");
for (Object ed : q.getResultList()) {
sections.add((Section)ed);
}
return sections;
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public List<Article> getAllArticles() {
ArrayList<Article> articles = new ArrayList<Article>();
Query q = em.createNamedQuery("findArticleAll");
for (Object ed : q.getResultList()) {
articles.add((Article)ed);
}
return articles;
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public List<Catalog> getAllCatalogs() {
Query q = em.createNamedQuery("findCatalogAll");
List<Catalog> catalogs = q.getResultList();
ArrayList<Catalog> catalogList = new ArrayList<Catalog>(catalogs.
size());
for (Catalog catalog : catalogs) {
catalogList.add(catalog);
}
return catalogList;
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public List<Catalog> getEditionCatalogs(Edition edition) {
em.merge(edition);
List<Catalog> catalogs = edition.getCatalogs();
ArrayList<Catalog> catalogList = new ArrayList<Catalog>(catalogs.
size());
for (Catalog catalog : catalogs) {
catalogList.add(catalog);
}
return catalogList;
}
/**
* Client can't call getEditions() on catalog, as it's detached &
* lazilly fetched
*/
 
Search WWH ::




Custom Search