yllekkram / sysc4907-video-store-system

1 stars 3 forks source link

Order IDs should be auto-generated #50

Closed yllekkram closed 11 years ago

yllekkram commented 11 years ago

Currently, when an order is created, an ID needs to be manually generated for it. This should be done automatically either by the database or hibernate. It SHOULD NOT be the presentation layer's responsibility.

For example, in OrdersServiceImpl, both addPurchase and addRental expect an orderID to be passed in.

yllekkram commented 11 years ago

I will try to get auto-generation of IDs working. I know it isn't difficult because I did it in my had_to_be_done branch.

ref: line 26 of User.java

edit: fixed line number

yllekkram commented 11 years ago

Outline of plan

  1. Set the ID column of the Orders table to auto-incement
  2. Add @GeneratedValue annotation to the ID field of Orders. This may involve mucking with OrdersPK.
  3. Remove unnecessary uses of the ID in methods
caleb-chan commented 11 years ago

Sounds good

yllekkram commented 11 years ago

In regards to point #2, mucking with ordersPK was more mucky than I thought.