Java Reference
In-Depth Information
To the session bean, add the methods discussed in the following table:
Method
Description
List<Edition> getAllEditions()
It gets a List of all the defined
Edition entity instances.
List<Section> getAllSections()
It gets a List of all the defined
Session entity instances.
List<Article> getAllArticles()
It gets a List of all the defined
Article entity instances.
List<Catalog> getAllCatalogs()
It gets a List of all the defined
Catalog entity instances.
List<Catalog>
getEditionCatalogs(Edition edition)
It gets all the Catalog entities for an
Edition entity.
List<Edition>
getCatalogEditions(Catalog catalog)
It gets all the Edition entities for a
Catalog entity.
List<Section>
getEditionSections(Edition edition)
It gets all the Section entities for an
Edition entity.
List<Article>
getSectionArticles(Section section)
It gets all the Article entities for a
Section entity.
void createTestData() It creates test data.
void deleteSomeData() It deletes data.
void removeEdition(Edition edition) It removes an Edition entity.
void removeSection(Section section) It removes a Section entity.
void removeArticle(Article article) It removes an Article entity.
The createTestData() method is used to create some test data. In the method
magazine, catalogs are created using the Catalog entity. Set the catalog journal with
the setJournal() method. Persist the entity using the persist() method and flush
the entity using the flush() method, as shown in the following code snippet. The
flush() method synchronizes the entity with the database.
Catalog catalog1 = new Catalog();
catalog1.setJournal(“Oracle Magazine”);
em.persist(catalog1);
em.flush();
Search WWH ::




Custom Search