@@ -61,28 +61,26 @@ private void processGeneratedKeys(Executor executor, MappedStatement ms, Object
61
61
String [] keyProperties = keyStatement .getKeyProperties ();
62
62
final Configuration configuration = ms .getConfiguration ();
63
63
final MetaObject metaParam = configuration .newMetaObject (parameter );
64
- if (keyProperties != null ) {
65
- // Do not close keyExecutor.
66
- // The transaction will be closed by parent executor.
67
- Executor keyExecutor = configuration .newExecutor (executor .getTransaction (), ExecutorType .SIMPLE );
68
- List <Object > values = keyExecutor .query (keyStatement , parameter , RowBounds .DEFAULT , Executor .NO_RESULT_HANDLER );
69
- if (values .size () == 0 ) {
70
- throw new ExecutorException ("SelectKey returned no data." );
71
- } else if (values .size () > 1 ) {
72
- throw new ExecutorException ("SelectKey returned more than one value." );
73
- } else {
74
- MetaObject metaResult = configuration .newMetaObject (values .get (0 ));
75
- if (keyProperties .length == 1 ) {
76
- if (metaResult .hasGetter (keyProperties [0 ])) {
77
- setValue (metaParam , keyProperties [0 ], metaResult .getValue (keyProperties [0 ]));
78
- } else {
79
- // no getter for the property - maybe just a single value object
80
- // so try that
81
- setValue (metaParam , keyProperties [0 ], values .get (0 ));
82
- }
64
+ // Do not close keyExecutor.
65
+ // The transaction will be closed by parent executor.
66
+ Executor keyExecutor = configuration .newExecutor (executor .getTransaction (), ExecutorType .SIMPLE );
67
+ List <Object > values = keyExecutor .query (keyStatement , parameter , RowBounds .DEFAULT , Executor .NO_RESULT_HANDLER );
68
+ if (values .size () == 0 ) {
69
+ throw new ExecutorException ("SelectKey returned no data." );
70
+ } else if (values .size () > 1 ) {
71
+ throw new ExecutorException ("SelectKey returned more than one value." );
72
+ } else {
73
+ MetaObject metaResult = configuration .newMetaObject (values .get (0 ));
74
+ if (keyProperties .length == 1 ) {
75
+ if (metaResult .hasGetter (keyProperties [0 ])) {
76
+ setValue (metaParam , keyProperties [0 ], metaResult .getValue (keyProperties [0 ]));
83
77
} else {
84
- handleMultipleProperties (keyProperties , metaParam , metaResult );
78
+ // no getter for the property - maybe just a single value object
79
+ // so try that
80
+ setValue (metaParam , keyProperties [0 ], values .get (0 ));
85
81
}
82
+ } else {
83
+ handleMultipleProperties (keyProperties , metaParam , metaResult );
86
84
}
87
85
}
88
86
}
0 commit comments