Spring MVC + hibernate: binding form to polymorphic class list
up vote
0
down vote
favorite
i have this structure class:
public class A
private list<B> b;
public class B
public class B1 extends B
public class B2 extends B
At the controller:
@RequestMapping("/A")
public ModelAndView getA()
model.addObject("a", a);
This method return the list with all B1 and B2 to the view and all ok.
But when i try submit the form:
@PostMapping("/saveA")
public ModelAndView saveA(@ModelAttribute A a, BindingResult bindingResult)
the specific values of each class dont save.
Is there any way to do this?
spring hibernate spring-mvc polymorphism
New contributor
add a comment |
up vote
0
down vote
favorite
i have this structure class:
public class A
private list<B> b;
public class B
public class B1 extends B
public class B2 extends B
At the controller:
@RequestMapping("/A")
public ModelAndView getA()
model.addObject("a", a);
This method return the list with all B1 and B2 to the view and all ok.
But when i try submit the form:
@PostMapping("/saveA")
public ModelAndView saveA(@ModelAttribute A a, BindingResult bindingResult)
the specific values of each class dont save.
Is there any way to do this?
spring hibernate spring-mvc polymorphism
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i have this structure class:
public class A
private list<B> b;
public class B
public class B1 extends B
public class B2 extends B
At the controller:
@RequestMapping("/A")
public ModelAndView getA()
model.addObject("a", a);
This method return the list with all B1 and B2 to the view and all ok.
But when i try submit the form:
@PostMapping("/saveA")
public ModelAndView saveA(@ModelAttribute A a, BindingResult bindingResult)
the specific values of each class dont save.
Is there any way to do this?
spring hibernate spring-mvc polymorphism
New contributor
i have this structure class:
public class A
private list<B> b;
public class B
public class B1 extends B
public class B2 extends B
At the controller:
@RequestMapping("/A")
public ModelAndView getA()
model.addObject("a", a);
This method return the list with all B1 and B2 to the view and all ok.
But when i try submit the form:
@PostMapping("/saveA")
public ModelAndView saveA(@ModelAttribute A a, BindingResult bindingResult)
the specific values of each class dont save.
Is there any way to do this?
spring hibernate spring-mvc polymorphism
spring hibernate spring-mvc polymorphism
New contributor
New contributor
New contributor
asked Nov 10 at 11:04
Gwaihir
1
1
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Gwaihir is a new contributor. Be nice, and check out our Code of Conduct.
Gwaihir is a new contributor. Be nice, and check out our Code of Conduct.
Gwaihir is a new contributor. Be nice, and check out our Code of Conduct.
Gwaihir is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238297%2fspring-mvc-hibernate-binding-form-to-polymorphic-class-list%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password