mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
Fix for #91 Stateless Update API Change, #90 Removed BeanState.setReference(), #89 Remove support for multiple @Id properties
This commit is contained in:
1 parent
5e2d592c2a
commit
0d1c9e2883
66 files changed
+1045
-1768
No files matched your search
@@ -201,12 +201,12 @@ public class CreateTableVisitor extends AbstractBeanVisitor {
|
||||
}
|
||||
|
||||
|
||||
BeanProperty[] ids = descriptor.propertiesId();
|
||||
BeanProperty idProp = descriptor.getIdProperty();
|
||||
|
||||
if (ids.length == 0){
|
||||
if (idProp == null){
|
||||
// No comma + new line
|
||||
ctx.removeLast().removeLast();
|
||||
} else if (ids.length > 1 || ddl.isInlinePrimaryKeyConstraint()) {
|
||||
} else if (ddl.isInlinePrimaryKeyConstraint()) {
|
||||
// The Primary Key constraint was inlined with the column
|
||||
// ... No comma + new line
|
||||
ctx.removeLast().removeLast();
|
||||
@@ -216,7 +216,7 @@ public class CreateTableVisitor extends AbstractBeanVisitor {
|
||||
String pkName = ddl.getPrimaryKeyName(table);
|
||||
ctx.write(" constraint ").write(pkName).write(" primary key (");
|
||||
|
||||
VisitorUtil.visit(ids, new AbstractPropertyVisitor() {
|
||||
VisitorUtil.visit(idProp, new AbstractPropertyVisitor() {
|
||||
|
||||
@Override
|
||||
public void visitEmbeddedScalar(BeanProperty p, BeanPropertyAssocOne<?> embedded) {
|
||||
|
||||
@@ -43,36 +43,36 @@ public class VisitorUtil {
|
||||
/**
|
||||
* Visit the bean using a visitor.
|
||||
*/
|
||||
public static void visitBean(BeanDescriptor<?> desc, BeanVisitor visitor) {
|
||||
public static void visitBean(BeanDescriptor<?> desc, BeanVisitor visitor) {
|
||||
|
||||
if (visitor.visitBean(desc)) {
|
||||
if (visitor.visitBean(desc)) {
|
||||
|
||||
BeanProperty[] propertiesId = desc.propertiesId();
|
||||
for (int i = 0; i < propertiesId.length; i++) {
|
||||
visit(visitor, propertiesId[i]);
|
||||
}
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
if (unidirectional != null){
|
||||
visit(visitor, unidirectional);
|
||||
}
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (int i = 0; i < propertiesNonTransient.length; i++) {
|
||||
BeanProperty p = propertiesNonTransient[i];
|
||||
if (!p.isFormula() && !p.isSecondaryTable()){
|
||||
visit(visitor, p);
|
||||
}
|
||||
}
|
||||
|
||||
visitor.visitBeanEnd(desc);
|
||||
}
|
||||
}
|
||||
|
||||
private static void visit(BeanVisitor visitor, BeanProperty p) {
|
||||
PropertyVisitor pv = visitor.visitProperty(p);
|
||||
if (pv != null){
|
||||
visit(p, pv);
|
||||
BeanProperty idProp = desc.getIdProperty();
|
||||
if (idProp != null) {
|
||||
visit(visitor, idProp);
|
||||
}
|
||||
BeanPropertyAssocOne<?> unidirectional = desc.getUnidirectional();
|
||||
if (unidirectional != null) {
|
||||
visit(visitor, unidirectional);
|
||||
}
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (int i = 0; i < propertiesNonTransient.length; i++) {
|
||||
BeanProperty p = propertiesNonTransient[i];
|
||||
if (!p.isFormula() && !p.isSecondaryTable()) {
|
||||
visit(visitor, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
visitor.visitBeanEnd(desc);
|
||||
}
|
||||
}
|
||||
|
||||
private static void visit(BeanVisitor visitor, BeanProperty p) {
|
||||
PropertyVisitor pv = visitor.visitProperty(p);
|
||||
if (pv != null) {
|
||||
visit(p, pv);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit all the properties.
|
||||
|
||||
Reference in new issue
Block a user