reset password
Author Message
cysun
Posts: 2935
Posted 10:53 Feb 02, 2015 |

When it comes to model design, some decisions are routine or obvious, e.g. each entity class should have a id field and User should have username and password, but some need more thinking. For GEFP, I think the answers to the following questions are important:

  • How to model a flight plan?
  • How to handle plan changes and how these changes are reflected in the students' view?
  • How to store student data (i.e. the checkpoints each student checked)?
  • How to model different types of users?

Attached is a sketch of my design that answers these questions. We'll discuss this and HW3 in general in class.
 

Last edited by cysun at 11:23 Feb 02, 2015.
cysun
Posts: 2935
Posted 15:22 Feb 03, 2015 |

Here's a post I wrote a few years ago about naming conventions, and here's a copy  of Coding Conventions for Java.
 

lmann2
Posts: 156
Posted 20:34 Feb 09, 2015 |

Why doesn't the model for Plan.java have a Department field? The relationship should be one to one, right? 

cysun
Posts: 2935
Posted 21:14 Feb 09, 2015 |
lmann2 wrote:

Why doesn't the model for Plan.java have a Department field? The relationship should be one to one, right? 

There are two relationships between Department and Plan - one is one-to-one and the other is one-to-many. I agree that it's better to have a Department field in Plan, which creates a bidirectional association for the one-to-many relationship (not the one-to-one relationship).

lishenyu
Posts: 103
Posted 10:36 Feb 11, 2015 |

Hi professor , I am facing a problem, eg I want to add a plan to a department ,while in the addPlan  jsp , the modelAttribute is a plan object which has no departmentId field .(I didn't put a department id field in Plan because in Department it has a planId field) , so after I add a plan and click submit in addPlan jsp ,it will tell an error because I department_id is missing . So that's :

departments.html?id=1 --->addPlan.html -->departments.html    . So could you give me some ideas how to pass an id in this situation ?Thank you !

cysun
Posts: 2935
Posted 12:48 Feb 11, 2015 |
lishenyu wrote:

Hi professor , I am facing a problem, eg I want to add a plan to a department ,while in the addPlan  jsp , the modelAttribute is a plan object which has no departmentId field .(I didn't put a department id field in Plan because in Department it has a planId field) , so after I add a plan and click submit in addPlan jsp ,it will tell an error because I department_id is missing . So that's :

departments.html?id=1 --->addPlan.html -->departments.html    . So could you give me some ideas how to pass an id in this situation ?Thank you !

You should have a department field in Plan. Read and understand my post above.

lishenyu
Posts: 103
Posted 12:56 Feb 11, 2015 |

as you have said it's not common to have a circular  in db , if in department there is plan_id , and in plan  there is department_id , 

so when drop the tables there will be errors because they are dependent on each other ?

cysun
Posts: 2935
Posted 12:58 Feb 11, 2015 |
lishenyu wrote:

as you have said it's not common to have a circular  in db , if in department there is plan_id , and in plan  there is department_id , 

so when drop the tables there will be errors because they are dependent on each other ?

I said it's not uncommon to have circular foreign key references, and I also explained how to drop the tables.