We have an entity defined in a 3rd party package which defines a sequence generator for its id: {code} @Entity @SequenceGenerator(name="xxxIdSeq", sequenceName="XXX_ID_SEQ") public class Xxx { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator="xxxIdSeq") private Long id;
// etcetera ... } {code} We should not change this class (as it is someone else's) so would wish to be able to override this via an orm file: {code} <entity class="org.thirdparty.Xxx"> <attributes> <id name="id"> <generated-value generator=" xxxIdSeq"/> <generic-generator name="xxxIdSeq" strategy="com.ourcorp.CustomIdGenerator"/> </id> </attributes> </entity> {code} However the intended override in the orm file is ignored in the case of a generic generator. Inspecting the class JPAOverriddenAnnotationReader suggests that generic generator has been omitted (for example there are mappings set up in the annotationToXml map for SequenceGenerator and TableGenerator but not for GenericGenerator).
I will submit a test case shortly in the form of a Maven/Eclipse project containing a small JPA app demonstrating this. I also have a proposed fix by extending JPAOverriddenAnnotationReader to include generic generators in a similar fashion to how it currently deals with sequence or table generators. Once I am satisfied that this fix addresses the issue I intend to submit a pull request.
thanks,
Richard |
|