Community
Participate
Working Groups
Changes to query policy to include the existence value. --------------------------------------------------------------- @Target({TYPE}) @Retention(RUNTIME) public @interface QueryPolicy { /** * (Optional) Set the existence check for determining * if an insert or update should occur for an object. */ ExistenceType existence() default CHECK_CACHE; ..... } public enum JoinFetchType { CHECK_CACHE, CHECK_DATABASE, ASSUME_EXISTENCE, ASSUME_NON_EXISTENCE } --------------------------------------------------------------- <xsd:complexType name="query-policy"> <xsd:annotation> <xsd:documentation> @Target({TYPE}) @Retention(RUNTIME) public @interface QueryPolicy { /** * (Optional) Set the existence check for determining * if an insert or update should occur for an object. */ ExistenceType existence() default CHECK_CACHE; ..... } </xsd:documentation> </xsd:annotation> <xsd:sequence> ..... </xsd:sequence> <xsd:attribute name="existence" type="orm:existence-type"/> ..... </xsd:complexType> <xsd:simpleType name="existence-type"> <xsd:restriction base="xsd:token"> <xsd:enumeration value="CHECK_CACHE" /> <xsd:enumeration value="CHECK_DATABASE" /> <xsd:enumeration value="ASSUME_EXISTENCE" /> <xsd:enumeration value="ASSUME_NON_EXISTENCE"/> </xsd:restriction> </xsd:simpleType>
Correction: public enum JoinFetchType { CHECK_CACHE, CHECK_DATABASE, ASSUME_EXISTENCE, ASSUME_NON_EXISTENCE } Should read public enum ExistenceType { CHECK_CACHE, CHECK_DATABASE, ASSUME_EXISTENCE, ASSUME_NON_EXISTENCE }
This will not be defined within the query-policy, instead it will be defined on its own as follows (configurable on entity and mapped-superclass): ------------------------ ANNOTATION ------------------------ @Target({TYPE}) @Retention(RUNTIME) public @interface ExistenceChecking { /** * (Optional) Set the existence check for determining * if an insert or update should occur for an object. */ ExistenceType value() default CHECK_CACHE; } public enum ExistenceType { CHECK_CACHE, CHECK_DATABASE, ASSUME_EXISTENCE, ASSUME_NON_EXISTENCE } ---------------------------- XML ---------------------------- <xsd:complexType name="existence-checking"> <xsd:annotation> <xsd:documentation> @Target({TYPE}) @Retention(RUNTIME) public @interface ExistenceChecking { /** * (Optional) Set the existence check for determining * if an insert or update should occur for an object. */ ExistenceType type() default CHECK_CACHE; } </xsd:documentation> </xsd:annotation> <xsd:attribute name="type" type="orm:existence-type"/> </xsd:complexType> <xsd:simpleType name="existence-type"> <xsd:restriction base="xsd:token"> <xsd:enumeration value="CHECK_CACHE" /> <xsd:enumeration value="CHECK_DATABASE" /> <xsd:enumeration value="ASSUME_EXISTENCE" /> <xsd:enumeration value="ASSUME_NON_EXISTENCE"/> </xsd:restriction> </xsd:simpleType>
Since existence-checking is used to set a single value, I don't think we need the complex-type for existence-checking and will add the attribute: <xsd:attribute name="existence-checking" type="orm:existence-type"/> to entity and mapped-superclass which maps directly to the type.
Created attachment 96085 [details] Proposed patch
Created attachment 96089 [details] Proposed patch - updated
Changes have been submitted. Reviewed by: Tom Ware New test (testExistenceCheckingSetting) added to 3 suites: org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJPAJunitTest org.eclipse.persistence.testing.tests.jpa.inherited.EmbeddableSuperclassJunitTest org.eclipse.persistence.testing.tests.jpa.xml.advanced.EntityMappingsAdvancedJUnitTestCase
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink