Skip to content

Commit 726808d

Browse files
docs: Clarify that annotation mode requires compiled classes
The JPA annotation section didn't explain that AnnotationIntrospector uses Java reflection and needs compiled @entity classes on the classpath — unlike HBM XML mode which reads raw files and has a standalone CLI tool. Added integration point guidance (startup, build time, unit tests) so users understand when each mode applies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a11c412 commit 726808d

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

src/site/xdoc/docs/openapi-jpa-schema.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,23 @@ request/response bodies that map directly to database entities.</p>
3535

3636
<h2 id="annotation_mode">JPA Annotation Mode</h2>
3737

38-
<p>The <code>AnnotationIntrospector</code> reads standard Jakarta Persistence
39-
annotations (<code>@Entity</code>, <code>@Column</code>, <code>@Id</code>,
38+
<p>The <code>AnnotationIntrospector</code> uses Java reflection to read
39+
Jakarta Persistence annotations from compiled <code>@Entity</code> classes.
40+
Unlike the <a href="#hbm_xml_mode">HBM XML mode</a> (which reads raw XML
41+
files and has a standalone CLI tool), annotation mode requires the entity
42+
classes to be compiled and on the classpath. Typical integration points:</p>
43+
44+
<ul>
45+
<li><strong>At startup</strong> — a Spring bean or context listener scans
46+
entity classes and generates schemas on first request</li>
47+
<li><strong>At build time</strong> — a Maven/Gradle task that runs after
48+
compilation (e.g., in the <code>process-classes</code> phase)</li>
49+
<li><strong>In unit tests</strong> — call
50+
<code>introspector.introspect(Product.class)</code> directly</li>
51+
</ul>
52+
53+
<p>The introspector reads standard Jakarta Persistence annotations
54+
(<code>@Entity</code>, <code>@Column</code>, <code>@Id</code>,
4055
<code>@ManyToOne</code>, <code>@OneToMany</code>, etc.) and produces an
4156
<code>EntitySchemaModel</code> that the <code>JpaSchemaGenerator</code>
4257
converts to JSON Schema.</p>

0 commit comments

Comments
 (0)