These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: @IndexColumn usage - do I need to create a column in MySQL?
PostPosted: Mon Aug 24, 2009 11:32 pm 
Newbie

Joined: Mon Jul 06, 2009 10:38 am
Posts: 17
I just started getting the '..cannot simultaneously fetch multiple bags..' error. My code that I have been using to map is below:

Code:
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name = "PlanOptionPlanOptionSection", joinColumns = @JoinColumn(name = "PlanOptionId"), inverseJoinColumns = @JoinColumn(name = "PlanOptionSectionId"))
List<PlanOptionSection> planOptionSections = new ArrayList<PlanOptionSection>();


If I want to add the @IndexColumn to prevent this error, do I need to add a new column to mysql table which is called 'PlanOptionPlanOptionSection'?
right now the table 'PlanOptionPlanOptionSection' looks like this:

ID: <PK>
PlanOptionId: INT(10)
PlanOptionSectionId: INT(10)

this is what I was thinking of changing it to:

Code:
@ManyToMany(fetch=FetchType.EAGER)
   @JoinTable(name = "PlanOptionPlanOptionSection", joinColumns = @JoinColumn(name = "PlanOptionId"), inverseJoinColumns = @JoinColumn(name = "PlanOptionSectionId"))
   @IndexColumn(name = "index", base = 1)
   List<PlanOptionSection> planOptionSections = new ArrayList<PlanOptionSection>();


I was just getting some errors when I tried to do this and I was unsure if I set it up right and what if any, my MySQL table should look like
with the join table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.