@@ -61,29 +61,27 @@ 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 ) {
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 ) {
70
69
throw new ExecutorException ("SelectKey returned no data." );
71
- } else if (values .size () > 1 ) {
70
+ } else if (values .size () > 1 ) {
72
71
throw new ExecutorException ("SelectKey returned more than one value." );
73
- } else {
72
+ } else {
74
73
MetaObject metaResult = configuration .newMetaObject (values .get (0 ));
75
74
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
- }
75
+ if (metaResult .hasGetter (keyProperties [0 ])) {
76
+ setValue (metaParam , keyProperties [0 ], metaResult .getValue (keyProperties [0 ]));
77
+ } else {
78
+ // no getter for the property - maybe just a single value object
79
+ // so try that
80
+ setValue (metaParam , keyProperties [0 ], values .get (0 ));
81
+ }
83
82
} else {
84
- handleMultipleProperties (keyProperties , metaParam , metaResult );
83
+ handleMultipleProperties (keyProperties , metaParam , metaResult );
85
84
}
86
- }
87
85
}
88
86
}
89
87
} catch (ExecutorException e ) {
0 commit comments