Claus Ibsen created CAMEL-24680:
-----------------------------------

             Summary: camel-jpa - Use field access for KeyValueEntry and cover 
all shipped entities in the Hibernate mapping test
                 Key: CAMEL-24680
                 URL: https://issues.apache.org/jira/browse/CAMEL-24680
             Project: Camel
          Issue Type: Improvement
          Components: camel-jpa
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen


Follow-up to CAMEL-24604 / CAMEL-24615, addressing review feedback on PR #26068 
that did not make it into the merged PR #26074.

1. {{KeyValueEntry}} uses property access (annotations on getters) while the 
constructor, {{isExpired()}} and {{toString()}} read the fields directly. That 
mismatch is what required {{@Transient}} on {{isExpired()}} in CAMEL-24604, and 
OpenJPA warns about it on every run:
{noformat}
"KeyValueEntry" uses property access, but its field "expiresAt" is accessed 
directly in method "isExpired"
{noformat}
Moving {{@Id}}/{{@Column}}/{{@Lob}} onto the fields (as 
Customer/VersionedItem/Address already do) makes any future helper getter safe 
by construction, removes the need for {{@Transient}}, and silences the 
warnings. The entity is @since 4.23 and unreleased, so the access type can 
still be changed without an upgrade note.

2. {{MessageProcessed}} is the other property-access @Entity shipped in the 
camel-jpa jar and is auto-discovered by Quarkus the same way, but no test ever 
maps it with Hibernate. The mapping test added in CAMEL-24604 should cover 
every shipped entity, not just KeyValueEntry.

3. The header comment in {{src/test/resources/META-INF/persistence.xml}} still 
says <provider> is "optional if OpenJPA is the only JPA provider", which is no 
longer true now that hibernate-core is unconditionally on the test classpath.

4. The comment on the openjpa profile in {{pom.xml}} states the wrong cause for 
moving the enhancer -javaagent into the profile: the agent jar is copied by the 
"full" profile regardless of -Dhibernate. The real reason is that 
PCEnhancerAgent.premain needs the OpenJPA runtime classes, which only the 
openjpa profile puts on the classpath.

No schema or behaviour change.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to