public PropertiesCategory createWithDatabase(PropertiesCategoryVO c, Database db) throws SystemException, PersistenceException { // Need this crappy hack to forge the relationship (castor completely sucks like this) // TODO: When hibernate comes, just save the VOs and if it has a child VO with an id set // TODO: it is used to make the relationship...ask me for clarification -frank Category category = (Category) getObjectWithId(CategoryImpl.class, c.getCategory().getId(), db); PropertiesCategory propertiesCategory = new PropertiesCategoryImpl(); propertiesCategory.setValueObject(c); propertiesCategory.setCategory((CategoryImpl) category); db.create(propertiesCategory); return propertiesCategory; }
/** * Saves a PropertiesCategoryVO whether it is new or not. * * @param c The PropertiesCategoryVO to save * @return The saved PropertiesCategoryVO * @throws SystemException If an error happens */ public PropertiesCategoryVO save(PropertiesCategoryVO c) throws SystemException { return c.isUnsaved() ? create(c) : (PropertiesCategoryVO) updateEntity(PropertiesCategoryImpl.class, c); }