mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1895 - Ebean creates invalid sql for particular @ManyToOne
This commit is contained in:
@@ -951,6 +951,7 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
}
|
||||
if (matchSet.size() == 1) {
|
||||
// all right with the world
|
||||
prop.clearTableJoin();
|
||||
return true;
|
||||
}
|
||||
if (matchSet.size() == 2) {
|
||||
|
||||
@@ -269,5 +269,12 @@ public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
|
||||
public <A> BeanDescriptor<A> getElementDescriptor() {
|
||||
return (BeanDescriptor<A>)elementDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the table join due to an implied mappedBy.
|
||||
*/
|
||||
public void clearTableJoin() {
|
||||
tableJoin.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -178,4 +178,16 @@ public class DeployTableJoin {
|
||||
columns.get(0).setLocalDbColumn(dbColumn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the join columns due to an implied mappedBy.
|
||||
* <p>
|
||||
* Effectively prior to clear this was considered a unidirectional OneToMany and the
|
||||
* foreign key was defined by naming convention. Clearing this means that it uses the
|
||||
* foreign key as defined by the implied mappedBy property (the only ManyToOne that
|
||||
* maps back to the parent (that holds the OneToMany).
|
||||
*/
|
||||
public void clear() {
|
||||
columns.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user