Bug 102 : Incorrect join when fetching parent and a manyToMany property
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
02/04/2009
Updated 
02/04/2009
Type 
Bug
 
Attachments 
No attachments

From: http://www.avaje.org/topic-120.html

@ManyToMany
/*@JoinTable(
name="event_group" ,
joinColumns =
@JoinColumn(name="event_id"),
inverseJoinColumns =
@JoinColumn(name="usergroup_id")
) */
private List groups;
.
.
.
Query q = Ebean.createQuery(Event.class);
q.join("groups");
q.where("groups.id=1");
final List eventList = q.findList();
.
.

select e.id, e.startdate, e.enddate, e.cdate, e.minpeople, e.maxpeople, e.comment, e.canceled, e.reason, e.deleted, e.archived, e.creator_id, e.category_id, e.location_id, g.id, g.name, g.description
from event e
left outer join event_group d on e.ID = d.event_id
left outer join usergroup g on e.usergroup_id = g.ID
where g.id=1

-------------------------------

the join is wrong.
left outer join usergroup g on e.usergroup_id = g.ID
should be
left outer join usergroup g on d.usergroup_id = g.ID

 
Rob 02 Apr 11:49
I have fixed this.

Just need to check a few more scenarios.

Rob 03 Apr 07:03
Fixed in HEAD

Fixed in HEAD.

woResponse

Upload a file