Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Structure in hibernate Question

 
Stevee Perry
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am currently learning hibernate (and am also quite new to Java in general) and have put together a few classes which link to database tables and as such there are foreign keys etc between these classes (You can see a diagram of this at the bottom of this post). Basically a quick overview of what I have done is created some classes which deal with customers who rent movies. I have my standard classes such as Movie, PriceCode, Customer as well as some others (the three I mentioned can be seen below, if you need to see the rest then I can also paste them).





I then have another class called CustomerRentalsMainApp which is going to add rentals to customers, search for movies, search for customers etc (not all are currently done but I intend to implement them shortly) but it seems like I am putting an awful lot of methods into this class, I have a populateMovie and generatePriceCode method which is just used to set up initial data but after that I have a FindMovieID method and will then be adding other methods such ass addCustomerRental etc. These are all in the one file as it requires sessions etc so as to insert them into the database but I cant help but think that I am putting a lot of methods in this class that should probably be placed in other classes more appropriate to the methodName. Ie the current findMovieID method should maybe be placed in a file which relates more to movies?


Any guidance/advice is most welcome as I am quite new to all of this.

Thanks in advance.
orm.jpg
[Thumbnail for orm.jpg]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic