Enforcing top-level classes

Enforcing top-level classes

According to the Java Persistence API specification, section 2.1, entities must be top-level classes:

The entity class must be a top-level class.

Hyperjaxb3 on its own does not (and technically cannot) enforce top-level class generation. You will need to use a JAXB customization to allow this:

schema.xsd
<?xml version="1.0"?>
<xs:schema
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">

	<xs:annotation>
		<xs:appinfo>
			<jaxb:globalBindings generateIsSetMethod="true" localScoping="toplevel">
				<jaxb:serializable/>
			</jaxb:globalBindings>
		</xs:appinfo>
	</xs:annotation>

	<!-- ... -->
</xs:schema>

Browse Space

- Pages
- News
- Labels
- Attachments
- Bookmarks
- Mail
- Activity
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide
- Impressum

Your Account

Log In

 

Other Features

Add Content