File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,24 @@ private void delegateCall(StringBuilder declaration) {
131
131
.append (parameterName )
132
132
.append (") {\n \t " );
133
133
}
134
+ if ( "upsert" .equals (operationName ) ) {
135
+ //TODO: only do this for @GeneratedValue
136
+ declaration
137
+ .append ("\t \t if (" )
138
+ .append (sessionName )
139
+ .append (".getFactory().getPersistenceUnitUtil().getIdentifier(" )
140
+ .append (iterateParameter ? "_entity" : parameterName )
141
+ .append (") == null)\n " )
142
+ .append ("\t \t \t " )
143
+ .append (sessionName )
144
+ .append ('.' )
145
+ .append ("insert" )
146
+ .append ('(' )
147
+ .append (iterateParameter ? "_entity" : parameterName )
148
+ .append (')' )
149
+ .append (";\n " )
150
+ .append ("\t \t else\n \t " );
151
+ }
134
152
declaration
135
153
.append ("\t \t " )
136
154
.append (sessionName )
You can’t perform that action at this time.
0 commit comments