reset password
Author Message
Posts: 519
Posted 21:07 Feb 13, 2015 |

I want to make a method that adds a Plan to a Runway, and a Runway to a Plan (their relation is bidirectional in my design), in my PlanDao and RunwayDao interfaces. Both classes have Lists to hold objects of the other class. When I create a new Runway, for example, it seems I can't do so without deciding on an implementation of List<Plan> (like ArrayList) and setting the list to a new instance of it, otherwise I get a nullpointer error when I try to add the Plan to it. Would it be bad practice to just go ahead and do this, or is there a way to allow Hibernate to do this. 

Also, is the policy of accepting late work with 10% penalty for 1 day late and 25% penalty for 2 days late apply to this assignment? I still want to get this done.

Posts: 2935
Posted 23:44 Feb 13, 2015 |

You need to create an ArrayList (or some other List implementation) before adding a Plan or a Runway. If the data is loaded from the database, Hibernate will create the List, but for new objects you need to create the List yourself. As for which List implementation to use, it doesn't really matter as these lists are all pretty small.

And yes, late submission policy applies to this assignment and all assignments unless otherwise specified (e.g. HW5).