I've got two entities, Order and Component. An Order can have many Components. In the model class for the Component entity I set the relationship based on the foreign key "orderID" of the referenced table Order as follows:
The thing I wanna know is how I can access the orderID column in this component from the datatables framework. I only can access the object order and all other columns in this model:
I want to get the orderID in the Component model and not only the referenced object for the mapping. When I type "orderID" instead of order DataTables throws an exception "DataTables warning (table id = 'DataTables_Table_0'): Requested unknown parameter 'orderID' from the data source for row 0" because he only knows order. Any idea how to resolve it? I'm a beginner in Java, Hibernate and frameworks like datatables.
posted 2 years ago
From the description, it seems like it is actually a Many-To-Many relationship between the Order and Component. An order can have multiple components and a component can be in multiple orders.
If the understanding is correct, there should be bidirectional relationship, a Many-To-Many annotation on Order (owning side) and Many-To-Many on Component (inverse side). With that you could fetch components from order and orders from components.
Did you just should on me? You should read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user