hibernate - Spring MVC + JPA - Binding/Updating Associated Entities -
Some of these questions relate to J.A.A., but more about approach than technology, so hopefully no advice Will be able to deliver.
I want to be in Spring MVC and Hibernate to bring a website into power which allows users to create products and make product descriptions. I have product edited, with bidirectional one-to-many relationships with ProductDescription.
If a form adds a frequency of the product when submitting the form, and all its product specifies the description, then a malicious user can enter the fake ID for ProductDescriptions and other users' data Can 'abduct' One solution for this will always be to make the producers new, so remove them when the form is submitted, and make them new every time. Due to the extra deletion and write operation it seems disqualified that the product will need to be updated every time (even if the product descriptors have not changed).
The 'ownership' of another option will be examined by the institutions before the child runs an update.
How do other people get this issue? Do most people delete / insert, or make selective updates?
Like submissions posted here, I am talking about: And an example of what I'm talking about: If you are interested in adding security to your application I recommend using spring safety and with it you can check in the sublet if the user owns that product before updating his values. In the same way we have done so far. Removes a bit of resources with server side checking, but by using the post, only advanced users can try to change the response header, so I do not think it is too much. Try using session to validate the user without security, but the problem is that if the session is terminated then no one can change the product. Cheers id = 1 name = My product description [0] .id = 123 details [0] .text = A beautiful description of my product description [0] .price = 100 Description [1] .id = 123 Description [1] .text = My other beautiful description Description of other language of the product [1] .price = 50
public class products {@Id @GeneratedValue (strategy = GenerationType AUTO) Private Integer ID; @OneToMany (mapped = "product") private set & lt; ProductDescription & gt; description; The name of the private string; } Public Class Product Description {@Id @GeneratedValue (strategy = GenerationType.AUTO) Private Integer ID; Private integer value; @ManyToOne Personal Product Products; Private string text; }
Comments
Post a Comment