Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

many to many jpa saving example  RSS feed

 
satish bodas
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I was able to do the jpa many to many example ( http://jpa.ezhibernate.com/Javacode/learn.jsp?tutorial=19mappingmanytomanyrelationships )

Thanks Cameron for the same .

However I am totally confused regarding how I should go about doing the same when I have an extra column in the Join Table

I know I would need to create a new Java Object for this join table

As an example ( Emp , Address , EmpAddress as three tables and Java Objects )

Should the Emp to Address & Address to Emp be mapped as a One to Many ?
Should the EmpAddress bean contain a Set for both Emp & Address and have this as a ManyToOne association ?

Thanks,
~satish
[ July 11, 2008: Message edited by: satish bodas ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, and this doesn't mean that it is the best way, but I like to create the new object, and just have the two Many to Ones on both sides>

But the ManyToMany still works with more annotations/mappings.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!