What is the best way to convert types to a Struts2 application?
Now I want to create a CRUD for a specific sleep object in my application. Let's say I wanted to change Accountwith which I am connected User. I can simply pass a parameter user.account.idwith a specific value, provided that I have all the correct getters / setters.
This works great when creating an object for the first time the account is zero. This forces ognl to create a new account object and set the id for what was transferred.
The problem occurs when trying to modify an encapsulated object Account. Using the same parameter user.account.id, ognl interprets this as getUser().getAccount().setId(param). Hibernate interprets this as an attempt to change the primary key.
I understand why he does this, I'm just wondering if there is a better way to handle this. This is very common in our application, and I do not want to create several objects and marshall them before I save them through sleep mode.
Does anyone have no better way to solve this problem in struts2?
source
share