Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
yesamer merged PR #2298: URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2298 -- 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] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2825722537
##
data-audit/kogito-addons-data-audit-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootAuditDataConfiguration.java:
##
@@ -18,13 +18,32 @@
*/
package org.kie.kogito.app.audit.springboot;
+import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
public class SpringbootAuditDataConfiguration {
+// Hibernate 7 + Spring ORM 6.2 workaround: Hibernate 7's
SessionFactory.getSchemaManager()
+// returns org.hibernate.relational.SchemaManager, conflicting with JPA
3.2's
+// EntityManagerFactory.getSchemaManager() returning
jakarta.persistence.SchemaManager.
+// Force plain JPA interface to avoid JDK Proxy incompatible return type
error.
+@Bean
+public static BeanPostProcessor
entityManagerFactoryInterfacePostProcessor() {
+return new BeanPostProcessor() {
+@Override
+public Object postProcessBeforeInitialization(Object bean, String
beanName) {
+if (bean instanceof LocalContainerEntityManagerFactoryBean
emfb) {
Review Comment:
this is addressed, by changing the names of methods. and added the same
config for data index as well
--
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]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2825720779
##
data-audit/kogito-addons-data-audit-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootAuditDataConfiguration.java:
##
@@ -18,13 +18,32 @@
*/
package org.kie.kogito.app.audit.springboot;
+import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
public class SpringbootAuditDataConfiguration {
+// Hibernate 7 + Spring ORM 6.2 workaround: Hibernate 7's
SessionFactory.getSchemaManager()
+// returns org.hibernate.relational.SchemaManager, conflicting with JPA
3.2's
+// EntityManagerFactory.getSchemaManager() returning
jakarta.persistence.SchemaManager.
+// Force plain JPA interface to avoid JDK Proxy incompatible return type
error.
+@Bean
+public static BeanPostProcessor
entityManagerFactoryInterfacePostProcessor() {
Review Comment:
Renamed the method name
--
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]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
martinweiler commented on code in PR #2298:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2823800871
##
data-audit/kogito-addons-data-audit-springboot/src/main/java/org/kie/kogito/app/audit/springboot/SpringbootAuditDataConfiguration.java:
##
@@ -18,13 +18,32 @@
*/
package org.kie.kogito.app.audit.springboot;
+import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan
public class SpringbootAuditDataConfiguration {
+// Hibernate 7 + Spring ORM 6.2 workaround: Hibernate 7's
SessionFactory.getSchemaManager()
+// returns org.hibernate.relational.SchemaManager, conflicting with JPA
3.2's
+// EntityManagerFactory.getSchemaManager() returning
jakarta.persistence.SchemaManager.
+// Force plain JPA interface to avoid JDK Proxy incompatible return type
error.
+@Bean
+public static BeanPostProcessor
entityManagerFactoryInterfacePostProcessor() {
Review Comment:
Please rename the method (eg.
`entityManagerFactoryInterfacePostProcessorAuditData`) to avoid clash at
runtime with SpringbootJPAJobStoreConfiguration
--
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]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298: URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2822589151 ## jobs-service/jobs-service-storage-jpa/src/main/java/org/kie/kogito/jobs/service/repository/jpa/model/JobDetailsEntity.java: ## @@ -25,6 +25,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.persistence.*; +import jakarta.persistence.Temporal; Review Comment: removed unnecessary imports ## jobs/kogito-addons-springboot-embedded-jobs/src/main/java/org/kie/kogito/app/jobs/springboot/SpringbootJobServiceConfiguration.java: ## @@ -39,6 +39,11 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +// Note: The Hibernate 7 + Spring ORM 6.2 EntityManagerFactory workaround (BeanPostProcessor for +// setEntityManagerFactoryInterface) is intentionally NOT in this class. This module does not have Review Comment: removed the comment -- 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] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298: URL: https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2822586399 ## data-index/data-index-springboot/kogito-addons-springboot-data-index-persistence/kogito-addons-springboot-data-index-persistence-jpa-parent/integration-tests-process/src/main/resources/application.properties: ## @@ -24,5 +24,4 @@ kogito.persistence.type=jdbc kie.flyway.enabled=true # Disabling Spring-Boot Flyway to avoid unnecessary Data Base initialization -spring.flyway.enabled=false - +spring.flyway.enabled=false Review Comment: reverted -- 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] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2822583669
##
data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/mapper/PojoMapper.java:
##
@@ -46,14 +51,60 @@ public PojoMapper(Class clazz) {
@Override
public List produce(List data) {
List transformed = new ArrayList<>();
+Class[] paramTypes = defaultConstructor.getParameterTypes();
for (Object[] row : data) {
try {
-transformed.add(defaultConstructor.newInstance(row));
+// Hibernate 7 changed default return types for native queries
+// (e.g. OffsetDateTime instead of java.util.Date, Long
instead of Integer).
+// Convert each value to match the constructor's declared
parameter types.
+Object[] convertedRow = convertTypes(row, paramTypes);
+transformed.add(defaultConstructor.newInstance(convertedRow));
} catch (InstantiationException | IllegalAccessException |
IllegalArgumentException | InvocationTargetException e) {
LOGGER.error("Could not transform data", e);
}
}
return transformed;
}
+private static Object[] convertTypes(Object[] row, Class[] paramTypes) {
+Object[] result = new Object[row.length];
+for (int i = 0; i < row.length; i++) {
+result[i] = (i < paramTypes.length) ? convertValue(row[i],
paramTypes[i]) : row[i];
+}
+return result;
+}
+
+private static Object convertValue(Object value, Class targetType) {
+if (value == null || targetType.isInstance(value)) {
+return value;
+}
+// Hibernate 7 returns java.time types instead of java.util.Date
+if (targetType == Date.class) {
+if (value instanceof OffsetDateTime) {
+return Date.from(((OffsetDateTime) value).toInstant());
+}
+if (value instanceof Instant) {
+return Date.from((Instant) value);
+}
+if (value instanceof LocalDateTime) {
+return Date.from(((LocalDateTime)
value).atZone(ZoneId.of("UTC")).toInstant());
+}
+}
+// Hibernate 7 may return different numeric types for native query
columns
+if (targetType == Integer.class || targetType == int.class) {
+if (value instanceof Number) {
+return ((Number) value).intValue();
+}
+}
+if (targetType == Long.class || targetType == long.class) {
+if (value instanceof Number) {
+return ((Number) value).longValue();
+}
+}
+if (targetType == String.class) {
+return value.toString();
Review Comment:
removed this check.
--
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]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Re: [PR] [incubator-kie-issues-2204] Quarkus upgrade 3.27.2 and Spring Boot to 3.5.10 [incubator-kie-kogito-apps]
jeejz commented on code in PR #2298:
URL:
https://github.com/apache/incubator-kie-kogito-apps/pull/2298#discussion_r2822584747
##
data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPADynamicQuery.java:
##
@@ -112,7 +110,9 @@ private Object transform(GraphQLOutputType outputType,
Object source) {
if (outputType instanceof GraphQLScalarType) {
GraphQLScalarType scalarType = (GraphQLScalarType) outputType;
if ("DateTime".equals(scalarType.getName())) {
-target = OffsetDateTime.ofInstant(((Timestamp)
source).toInstant(), ZoneId.of("UTC"));
+// Hibernate 7 returns OffsetDateTime directly for temporal
columns in native queries,
Review Comment:
removed the comment
##
data-audit/kogito-addons-data-audit-jpa/kogito-addons-data-audit-jpa-common/src/main/java/org/kie/kogito/app/audit/jpa/queries/JPADynamicQuery.java:
##
@@ -112,7 +110,9 @@ private Object transform(GraphQLOutputType outputType,
Object source) {
if (outputType instanceof GraphQLScalarType) {
GraphQLScalarType scalarType = (GraphQLScalarType) outputType;
if ("DateTime".equals(scalarType.getName())) {
-target = OffsetDateTime.ofInstant(((Timestamp)
source).toInstant(), ZoneId.of("UTC"));
+// Hibernate 7 returns OffsetDateTime directly for temporal
columns in native queries,
+// not java.sql.Timestamp as in Hibernate 5/6. Use
DateTimeUtil for cross-version compatibility.
+target = DateTimeUtil.toDateTime(source);
Review Comment:
removed the comment
--
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]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
