diff --git a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatabaseQueryMechanism.java b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatabaseQueryMechanism.java index 6939d096ff7..2d7742ba204 100644 --- a/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatabaseQueryMechanism.java +++ b/foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/queries/DatabaseQueryMechanism.java @@ -1081,6 +1081,7 @@ && isExpressionQueryMechanism()) {// this is not a hand-coded call (custom SQL e // PERF: Avoid events if no listeners. if (eventManager.hasAnyEventListeners()) { DescriptorEvent event = new DescriptorEvent(DescriptorEventManager.PreUpdateWithChangesEvent, writeQuery); + event.setChangeSet(changeSet); eventManager.executeEvent(event); // PreUpdateWithChangesEvent listeners may have altered the object - should recalculate the change set. diff --git a/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/BeanValidationTableCreator.java b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/BeanValidationTableCreator.java index a5216a0dae3..91bc833e9ea 100644 --- a/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/BeanValidationTableCreator.java +++ b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/BeanValidationTableCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -22,6 +22,7 @@ public BeanValidationTableCreator() { setName("BeanValidationEmployeeProject"); addTableDefinition(buildProjectTable()); + addTableDefinition(buildTaskTable()); addTableDefinition(buildEmployeeTable()); addTableDefinition(buildEmployeeProjectTable()); } @@ -53,6 +54,54 @@ public TableDefinition buildProjectTable() { return table; } + public TableDefinition buildTaskTable() { + TableDefinition table = new TableDefinition(); + table.setName("CMP3_BV_TASK"); + + FieldDefinition fieldID = new FieldDefinition(); + fieldID.setName("ID"); + fieldID.setTypeName("NUMBER"); + fieldID.setSize(19); + fieldID.setSubSize(0); + fieldID.setIsPrimaryKey(true); + fieldID.setIsIdentity(true); + fieldID.setShouldAllowNull(false); + table.addField(fieldID); + + FieldDefinition fieldVersion = new FieldDefinition(); + fieldVersion.setName("VERSION"); + fieldVersion.setTypeName("NUMBER"); + fieldVersion.setSize(19); + fieldVersion.setSubSize(0); + fieldVersion.setIsPrimaryKey(false); + fieldVersion.setIsIdentity(false); + fieldVersion.setShouldAllowNull(false); + table.addField(fieldVersion); + + FieldDefinition fieldName = new FieldDefinition(); + fieldName.setName("NAME"); + fieldName.setTypeName("VARCHAR"); + fieldName.setSize(20); + fieldName.setShouldAllowNull(true); + fieldName.setIsPrimaryKey(false); + fieldName.setUnique(false); + fieldName.setIsIdentity(false); + table.addField(fieldName); + + FieldDefinition fieldPriority = new FieldDefinition(); + fieldPriority.setName("PRIORITY"); + fieldPriority.setTypeName("NUMBER"); + fieldPriority.setSize(19); + fieldPriority.setSubSize(0); + fieldPriority.setIsPrimaryKey(false); + fieldPriority.setIsIdentity(false); + fieldPriority.setShouldAllowNull(false); + table.addField(fieldPriority); + + return table; + } + + public TableDefinition buildEmployeeTable() { TableDefinition table = new TableDefinition(); table.setName("CMP3_BV_EMPLOYEE"); diff --git a/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/Task.java b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/Task.java new file mode 100644 index 00000000000..63becfc4d34 --- /dev/null +++ b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/java/org/eclipse/persistence/testing/models/jpa/beanvalidation/Task.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, 2024 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, + * or the Eclipse Distribution License v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +// Contributors: + +package org.eclipse.persistence.testing.models.jpa.beanvalidation; + +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Column; +import jakarta.persistence.Version; +import jakarta.validation.constraints.NotNull; + +@Entity(name="CMP3_BV_TASK") +public class Task { + + @Id + private int id; + + @Version + private int version; + + @NotNull + private String name; + + @Column + private int priority; + + public Task() {} + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public int getPriority() { + return priority; + } + + public void setPriority(final int priority) { + this.priority = priority; + } +} diff --git a/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/resources/META-INF/persistence.xml b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/resources/META-INF/persistence.xml index bc783787a7a..5f999f24b88 100644 --- a/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/resources/META-INF/persistence.xml +++ b/jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/src/main/resources/META-INF/persistence.xml @@ -1,6 +1,6 @@