beginTransaction(db);
try
{
Repository repository = RepositoryController.getController().getRepositoryWithId(repositoryVO.getRepositoryId(), db);
RepositoryLanguageController.getController().deleteRepositoryLanguages(repository, db);
//add validation here if needed
List repositoryLanguageList = new ArrayList();
if(languageValues != null)
{
for (int i=0; i < languageValues.length; i++)
{
Language language = LanguageController.getController().getLanguageWithId(new Integer(languageValues[i]), db);
RepositoryLanguage repositoryLanguage = RepositoryLanguageController.getController().create(repositoryVO.getRepositoryId(), new Integer(languageValues[i]), new Integer(i), db);
repositoryLanguageList.add(repositoryLanguage);
language.getRepositoryLanguages().add(repositoryLanguage);
}
}
repository.setValueObject(repositoryVO);
repository.setRepositoryLanguages(repositoryLanguageList);
repositoryVO = repository.getValueObject();
//If any of the validations or setMethods reported an error, we throw them up now before create.
ceb.throwIfNotEmpty();
commitTransaction(db);