Why can't I cast a CMR Collection into an ArrayList?
private CompanyDetail copyCompanyToDetail(CompanyDetailLocal userLocal) { CompanyDetail detail = null; try { detail = new CompanyDetail(); detail.setId(userLocal.getId()); detail.setName(userLocal.getName()); detail.setUsers((ArrayList)userLocal.getUsers()); } catch (Exception e) { Logger.info("ERROR"); e.printStackTrace(); } return detail; }
I think this is because of the EJB spec.
All CMR fields are of type Collection or Set.
You never know the real implementation of the Collection of Set.
If you want an ArrayList just create one and populate this one with help of the returned Collection or Set.
Johan.