1 22 package org.jboss.ejb3.test.regression.salesforce7123; 23 24 import java.util.List ; 25 import javax.persistence.PersistenceContext; 26 import javax.persistence.EntityManager; 27 import javax.ejb.Stateless ; 28 29 35 @Stateless 36 public class DataAccessBean implements DataAccess, DataAccessRemote 37 { 38 @PersistenceContext EntityManager manager; 39 40 41 public void initialize() 42 { 43 BaseData data = new BaseData(); 44 data.setName("Bill"); 45 Child molly = new Child(); 46 molly.setData("molly"); 47 molly.setParent(data); 48 data.getChildren().add(molly); 49 manager.persist(data); 50 } 51 52 public List findMyBeans() 53 { 54 List list = manager.createQuery("FROM BaseData base").getResultList(); 55 for (Object obj : list) 56 { 57 BaseData data = (BaseData)obj; 58 data.getChildren().size(); 59 } 60 return list; 61 } 62 } 63 | Popular Tags |