Reputation: 845
Is there a way to check if the java object changed after submitting in JSF, without storing the instance manually or quering database before persist. I am using primefaces and omnifaces framework in my application.
@Named("bean")
public class bean implement serialization{
private Person newPerson;
public void doSave(ActionEvent event) {
//compare person object
if(newPerson.equal(submittedPerson)){
//message to user for no changes to apply
----
}else{
//do persist
----
};
//getter and setter
---
---
Upvotes: 1
Views: 1215
Reputation: 52185
You could compute and compare the object's hash code before and after submission. That way, you will not have to store the actual object itself.
Upvotes: 4