-
1. Re: one to many error cmr
benholland Mar 25, 2003 10:31 AM (in response to benholland)I think this could be a bug you know.
The following code snippets:
Add a new account to customer bean
AccountLocalHome accHome =
(AccountLocalHome) ctx.lookup("local/Account");
AccountLocal newAccount =
accHome.create(newAccountNo);
Then show a list of accs
InitialContext ctx = new InitialContext();
//for the lookup
CustomerLocalHome home = (CustomerLocalHome) ctx.lookup("local/Customer");
CustomerLocal cust =
home.findByPrimaryKey(new CustomerPK(customerID));
String cus_name = cust.getName();
System.out.println("cust name: "+cus_name);
Iterator iterator = cust.getAccounts().iterator();
while(iterator.hasNext()){
AccountLocal account =(AccountLocal) iterator.next();
System.out.println(account.getClass());
Integer accNo = account.getAccountNumber();
System.out.println("acc no:"+accNo);
}//end while
I have updated my jbosscmp xml so that jboss generates the account table but I still get the problem. IT seems to be intermittent.
I can add several accounts but then I get then entity not found exception found.