Reputation: 2367
Or I'm doing smth wrong, or it's really not suitable to work together. I'm talking about nested entities, since almost each Hibernate entity has it.
Here's the simple entity:
@Entity
...
public class Car implements Serializable {
String name;
@ManyToOne Category category;
...
}
And the simple controller as well:
@RequestMapping(value = "/cars/add", method = RequestMethod.POST)
public void add(Car car) {
// persist the car here
}
Now I want to specify a category directly from the form. Since it isn't simple object but entity, I'm unable to do that, isn't it?
So, to specify the category seems I'm forced to send it separately from Car object... It's ugly approach that makes no sense to use Hibernate with Spring at all.
Or I'm wrong and there're ways better a lot?
Upvotes: 0
Views: 43
Reputation: 857
How your form structure is? I suggest you to use json(means @RequestBody in controller) to submit the form or use @CommandObj to submit the form
Upvotes: 1