Hibernate mapping issue where id element is required yet it's given

Hi!

My mapping file.

Or short part of it.

<class name="IdentifierSource" table="idgen_identifier_source" abstract="true" discriminator-value="IDENTIFIERSOURCE">
	<id name="id" type="int" column="id" unsaved-value="0"><generator class="native" /></id>
	<property name="uuid" type="string" length="38" not-null="true" />
	<property name="name" type="string" not-null="true" />
	<property name="description" type="string" />
	<many-to-one name="identifierType" class="org.openmrs.PatientIdentifierType" column="identifier_type" not-null="true" />
	<many-to-one name="creator" class="org.openmrs.User" not-null="true" />
	<property name="dateCreated" type="java.util.Date" column="date_created" not-null="true" />
	<many-to-one name="changedBy" class="org.openmrs.User" column="changed_by" />
	<property name="dateChanged" type="java.util.Date" column="date_changed" />		
	<property name="retired" type="java.lang.Boolean" length="1" not-null="true"/>
	<many-to-one name="retiredBy" class="org.openmrs.User" column="retired_by" />
	<property name="dateRetired" type="java.util.Date" column="date_retired" />	
	<property name="retireReason" type="string" column="retire_reason" />
	
	<set name="reservedIdentifiers" table="idgen_reserved_identifier" lazy="true" cascade="all-delete-orphan">
		<key column="source" not-null="true" />
		<element column="identifier" type="string"/>
	</set>
	
	<discriminator column="source_type" />
	
	<subclass name="SequentialIdentifierGenerator" discriminator-value="SEQ">
		<join table="idgen_seq_id_gen">
			<key column="id"/>
			<property name="nextSequenceValue" type="long" access="field" insert="false" update="false">
				<column name="next_sequence_value" default="-1" not-null="true"/>
			</property>
			<property name="baseCharacterSet" type="string" column="base_character_set" not-null="true" />
			<property name="firstIdentifierBase" type="string" column="first_identifier_base" not-null="true" />
			<property name="prefix" type="string" />
			<property name="suffix" type="string" />
			<property name="minLength" type="int" column="min_length" />
            <property name="maxLength" type="int" column="max_length" />
            <property name="isLocationPrefixedIdentifierSource" type="java.lang.Boolean" length="1" not-null="true" column="is_location_prefixed_identifier_source"/>
		</join>
    </subclass>

	<subclass name="RemoteIdentifierSource" discriminator-value="REMOTE">
		<join table="idgen_remote_source">
			<key column="id"/>
			<property name="url" type="string" not-null="true" />
            <property name="user" type="string" not-null="false" />
            <property name="password" type="string" not-null="false" />
		</join>
	</subclass>

	<subclass name="IdentifierPool" discriminator-value="POOL">
		<join table="idgen_id_pool">
			<key column="id"/>
			<many-to-one name="source" class="IdentifierSource" lazy="false" />
			<property name="batchSize" type="int" column="batch_size" />
			<property name="minPoolSize" type="int" column="min_pool_size" />
            <property name="refillWithScheduledTask" type="java.lang.Boolean" column="refill_with_scheduled_task" length="1" not-null="true"/>
            <property name="sequential" type="java.lang.Boolean" length="1" not-null="true"/>
			<set name="identifiers" lazy="true" cascade="all-delete-orphan" inverse="true" access="field">
				<key column="pool_id" not-null="true" />
				<one-to-many class="PooledIdentifier" />
			</set>
		</join>
	</subclass>
	
</class>

I’m not using <joined-subclass> because I’m planning to inheritance-mixing-tableperclass-tablepersubclass.

However I’m getting this error:

ERROR - ErrorLogger.error(57) |2019-04-09 12:17:19,614| Error parsing XML (68) : The content of element type "join" must match "(subselect?,comment?,key,(property|many-to-one|component|dynamic-component|any)*,sql-insert?,sql-update?,sql-delete?)".
ERROR - ErrorLogger.error(57) |2019-04-09 12:17:19,615| Error parsing XML (71) : The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".
ERROR - ErrorLogger.error(57) |2019-04-09 12:17:19,619| Error parsing XML (2) : The content of element type "join" must match "(subselect?,comment?,key,(property|many-to-one|component|dynamic-component|any)*,sql-insert?,sql-update?,sql-delete?)".
ERROR - ErrorLogger.error(57) |2019-04-09 12:17:19,620| Error parsing XML (2) : The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".

Thanks.

cc : @vlad or other person :slight_smile:

@Male_Samuel I’m off for some time, so you should definitely ask someone from the Hibernate development team.

I got my issue resolved.

Just incase someone encounters the same issue.

cc: https://blog.csdn.net/pursuer211/article/details/17315865 and https://forum.hibernate.org/viewtopic.php?f=1&t=985518&start=0