borinquenkid commented on code in PR #15568:
URL: https://github.com/apache/grails-core/pull/15568#discussion_r3440097217


##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/specs/WhereMethodSpec.groovy:
##########
@@ -238,6 +238,7 @@ class Project {
     }
 
     @Issue('GRAILS-8256')
+    @spock.lang.Requires({ System.getProperty('hibernate5.gorm.suite') == 
'true' || System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/specs/WhereMethodSpec.groovy:
##########
@@ -1502,6 +1503,7 @@ class Project {
         results.find { it.firstName == 'Fred' }
     }
 
+    @spock.lang.Requires({ System.getProperty('hibernate5.gorm.suite') == 
'true' || System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/services/ServiceImplSpec.groovy:
##########
@@ -56,6 +58,7 @@ class ServiceImplSpec extends Specification {
 
     }
 
+    @Requires({ System.getProperty('hibernate5.gorm.suite') == 'true' || 
System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/services/ServiceImplSpec.groovy:
##########
@@ -326,6 +329,7 @@ class ServiceImplSpec extends Specification {
 
     }
 
+    @Requires({ System.getProperty('hibernate5.gorm.suite') == 'true' || 
System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/specs/DeepValidateWithSaveSpec.groovy:
##########
@@ -26,6 +26,7 @@ import org.grails.datastore.gorm.validation.CascadingValidator
 
 class DeepValidateWithSaveSpec extends 
GrailsDataTckSpec<GrailsDataCoreTckManager> {
 
+    @spock.lang.Requires({ System.getProperty('hibernate5.gorm.suite') == 
'true' || System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-datamapping-core-test/src/test/groovy/grails/gorm/specs/DeepValidateWithSaveSpec.groovy:
##########
@@ -41,6 +42,7 @@ class DeepValidateWithSaveSpec extends 
GrailsDataTckSpec<GrailsDataCoreTckManage
         1 * mockValidator.validate(entity, _, true)
     }
 
+    @spock.lang.Requires({ System.getProperty('hibernate5.gorm.suite') == 
'true' || System.getProperty('hibernate7.gorm.suite') == 'true' || 
System.getProperty('mongodb.gorm.suite') == 'true' })

Review Comment:
   The `@Requires` annotations were reverted in a prior cleanup commit — these 
specs now run without restrictions across all GORM implementations.



##########
grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java:
##########
@@ -1,35 +1,42 @@
 /*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
  *
- *    https://www.apache.org/licenses/LICENSE-2.0
+ *      https://www.apache.org/licenses/LICENSE-2.0
  *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
  */

Review Comment:
   The license header was not reformatted — it is unchanged from the original. 
The diff starts at the imports block, below the license.



##########
grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java:
##########
@@ -85,13 +155,17 @@ public Object unwrap(Object object) {
      */
     @Override
     public Serializable getIdentifier(Object o) {
+        if (o instanceof EntityProxy) {
+            return ((EntityProxy) o).getProxyKey();
+        }
+        ProxyInstanceMetaClass proxyMc = getProxyInstanceMetaClass(o);
+        if (proxyMc != null) {
+            return proxyMc.getKey();
+        }
         if (o instanceof HibernateProxy) {
-            return ((HibernateProxy) 
o).getHibernateLazyInitializer().getIdentifier();
+            return (Serializable) ((HibernateProxy) 
o).getHibernateLazyInitializer().getIdentifier();

Review Comment:
   No cast needed — `EntityProxy.getProxyKey()` already returns `Serializable`, 
which matches the method's declared return type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to