Encountered a situation where updates and additions in IE show results in Chrome :D
// Extract category object and id from the parent
$scope.addNewCategory = function (category, parentId) {
$scope.resetError();
category.parentId = parentId.id;
$http.post('/guardian/springmvc/categories/addCategoryValue', category).success(function () {
$scope.retriveCategoryValues(parentId);
$scope.category.parentId = '';
$scope.category.name = '';
$scope.category.description = '';
}).
error(function (data, status, headers, config) {
// execute this block if an error occurs asynchronously
// or server responds with an error status.
$scope.setError('Could not add new category');
console.log(data);
});
};
// Extract category value object and id from the parent
$scope.editCategoryValue = function (categoryValue, parentId) {
$scope.resetError();
categoryValue.id = categoryValue.id;
categoryValue.parentId = parentId.id;
$http.put('/guardian/springmvc/categories/updateCategoryValue', categoryValue).success(function () {
$scope.retriveCategoryValues(parentId);
$scope.categoryValue.parentId = '';
$scope.categoryValue.id = '';
$scope.categoryValue.name = '';
$scope.categoryValue.description = '';
$scope.editMode = false;
}).
error(function (data, status, headers, config) {
// execute this block if an error occurs asynchronously
// or server returns response with an error status.
$scope.setError('Could not update category');
console.log(data);
});
};
Refer to Rest Controller code provided below.
In Chrome, Insert and Update operations are functioning correctly.
/**
* Creates a new category.
* @param created The information of the category to create.
* @return The created category.
*/
@RequestMapping(method = RequestMethod.POST, value = "/addCategoryValue", produces = "application/json")
public
@ResponseBody
OrgCategoryDTO addNewCategory(@RequestBody OrgCategoryDTO categoryToCreate) {
try {
if(LOGGER.isInfoEnabled()) {
LOGGER.info("CategoryController: calling categoryService's create");
}
if(categoryToCreate != null)
return categoryService.create(categoryToCreate);
} catch (Exception e) {
LOGGER.debug("Exception " + e);
}
return new OrgCategoryDTO();
}
/**
* Updates the information of a category.
* @param updated The information of the category to update.
* @return void.
*/
@RequestMapping(method = RequestMethod.PUT, value = "/updateCategoryValue", produces = "application/json")
public
@ResponseBody
void updateCategory(@RequestBody OrgCategoryDTO categoryToUpdate) {
if(LOGGER.isInfoEnabled()) {
LOGGER.info("CategoryController: calling categoryService's update");
}
try {
if(categoryToUpdate != null)
categoryService.update(categoryToUpdate);
} catch (Exception e) {
LOGGER.debug("Exception " + e);
}
}
Server Logs for Update action
SUCCESSFULLY LOADED validation.properties via the CLASSPATH from '/ (root)' using current thread context class loader!
Hibernate: select orgcategor0_.CATEGORY_ID as CATEGORY1_0_0_, orgcategor0_.CMS_TIMESTAMP as CMS2_0_0_, orgcategor0_.DESCRIPTION as DESCRIPT3_0_0_, orgcategor0_.ENABLED as ENABLED4_0_0_, orgcategor0_.ROW_TIMESTAMP as ROW5_0_0_, orgcategor0_.CATEGORY_LEVEL as CATEGORY6_0_0_, orgcategor0_.NAME as NAME7_0_0_, orgcategor0_.CATEGORY_TYPE as CATEGORY8_0_0_ from ORG_CATEGORY orgcategor0_ where orgcategor0_.CATEGORY_ID=?
Hibernate: update ORG_CATEGORY set CMS_TIMESTAMP=?, DESCRIPTION=?, ENABLED=?, ROW_TIMESTAMP=?, CATEGORY_LEVEL=?, NAME=?, CATEGORY_TYPE=? where CATEGORY_ID=?
Server logs for Insert Action
Hibernate: select orgcategor0_.CATEGORY_ID as CATEGORY1_0_0_, orgcategor0_.CMS_TIMESTAMP as CMS2_0_0_, orgcategor0_.DESCRIPTION as DESCRIPT3_0_0_, orgcategor0_.ENABLED as ENABLED4_0_0_, orgcategor0_.ROW_TIMESTAMP as ROW5_0_0_, orgcategor0_.CATEGORY_LEVEL as CATEGORY6_0_0_, orgcategor0_.NAME as NAME7_0_0_, orgcategor0_.CATEGORY_TYPE as CATEGORY8_0_0_ from ORG_CATEGORY orgcategor0_ where orgcategor0_.CATEGORY_ID=?
Hibernate: select childcateg0_.FK_ORG_CATEGORY_ID as FK5_0_2_, childcateg0_.CATEGORY_IMPCATEGORY_ID as CATEGORY1_2_2_, childcateg0_.CATEGORY_IMPCATEGORY_ID as CATEGORY1_2_1_, childcateg0_.FK_ORG_IMP_CAT_ID as FK4_2_1_, childcateg0_.CMS_TIMESTAMP as CMS2_2_1_, childcateg0_.ROW_TIMESTAMP as ROW3_2_1_, childcateg0_.FK_ORG_CATEGORY_ID as FK5_2_1_, orgcategor1_.CATEGORY_ID as CATEGORY1_0_0_, orgcategor1_.CMS_TIMESTAMP as CMS2_0_0_, orgcategor1_.DESCRIPTION as DESCRIPT3_0_0_, orgcategor1_.ENABLED as ENABLED4_0_0_, orgcategor1_.ROW_TIMESTAMP as ROW5_0_0_, orgcategor1_.CATEGORY_LEVEL as CATEGORY6_0_0_, orgcategor1_.NAME as NAME7_0_0_, orgcategor1_.CATEGORY_TYPE as CATEGORY8_0_0_ from ORG_CATEGORY_MAP childcateg0_ left outer join ORG_CATEGORY orgcategor1_ on childcateg0_.FK_ORG_IMP_CAT_ID=orgcategor1_.CATEGORY_ID where childcateg0_.FK_ORG_CATEGORY_ID=?
Hibernate: insert into ORG_CATEGORY (CMS_TIMESTAMP, DESCRIPTION, ENABLED, ROW_TIMESTAMP, CATEGORY_LEVEL, NAME, CATEGORY_TYPE, CATEGORY_ID) values (?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into ORG_CATEGORY_MAP (FK_ORG_IMP_CAT_ID, CMS_TIMESTAMP, ROW_TIMESTAMP, FK_ORG_CATEGORY_ID, CATEGORY_IMPCATEGORY_ID) values (?, ?, ?, ?, ?)