Java Reference
In-Depth Information
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public String test() {
String catalogEntry = "A catalog entry: ";
try {
em.clear();
em.setFlushMode(FlushModeType.COMMIT);
Catalog catalog1 =
new Catalog("Kimberly Floss", "Nov-Dec 2004", new Integer(1),
"Oracle Magazine", "Oracle Publishing",
"Database Resource Manager");
Catalog c1 = em.merge(catalog1);
persistEntity(c1);
Catalog catalog2 =new Catalog("Jonas Jacobi", "Nov-Dec 2004",
new Integer(2),"Oracle Magazine",
"Oracle Publishing",
"From ADF UIX to JSF");
Catalog c2 = em.merge(catalog2);
persistEntity(c2);
Catalog catalog3 =new Catalog("Steve Muench", "March-April 2005",
new Integer(3),"Oracle Magazine",
"Oracle Publishing",
"Starting with Oracle ADF");
Catalog c3 = em.merge(catalog3);
persistEntity(c3);
/* catalog2 =new Catalog("Jonas Jacobi", "Nov-Dec 2004",
new Integer(2),"Oracle Magazine",
"Oracle Publishing","From ADF UIX to JSF");
c2 = em.merge(catalog2);
em.remove(c2);
em.flush();
catalog3 =new Catalog("Steve Muench", "March-April 2005",
new Integer(3),"Oracle Magazine",
"Oracle Publishing",
"Starting with Oracle ADF");
c3 = em.merge(catalog3);
em.remove(c3);
em.flush();*/
List catalogList = em.createQuery("SELECT c from Catalog c
where c.author=:name").setParameter
("name","Jonas Jacobi").getResultList();
for (Iterator iter = catalogList.iterator(); iter.hasNext(); ) {
Catalog element = (Catalog)iter.next();
 
Search WWH ::




Custom Search