1

Tables:

Car

  • Long :: Car_id
  • String :: Type

Owner

  • Long :: Owner_id
  • String :: name
  • int :: age

Car_Owner

  • Long :: Car_Id
  • Long :: Owner_Id
  • Date :: Bought_Date

Question:

So i understand the best way to transfer data between java and a SQL DB is by using the java persistence API. Each table is represented as a java class with the @Entity annotation.

But how is the mid-table "Car_Owner" represented as a java class?

MrMe TumbsUp
  • 416
  • 1
  • 4
  • 17
  • 1
    See here (many-to-many): http://stackoverflow.com/questions/5127129/mapping-many-to-many-association-table-with-extra-columns – Multisync Oct 16 '14 at 17:28

1 Answers1

0

the main idea is the relationship between both classes. check this wiki-link for more info about OneToOne relationship ( only if the business here is that a car has only one owner ). if the business is that Owner has many cars , then check the ManyToOne Link.

good luck with your assignment :)

Etch
  • 13
  • 3