Hibernate: can I override an identifier generator using XML with a custom generator?
- by Ken Liu
I want to use a custom sequence generator in my application, but the entity is located in a domain model jar that is shared with other applications. Apparently entity annotations can be overridden in orm.xml but I can't figure out the proper XML incantation to get this to work.
I can modify the annotation in the entity like this this:
@GenericGenerator(name = "MYGEN", strategy = "MyCustomGenerator")
@GeneratedValue(generator = "MYGEN")
But I need to somehow map this to orm.xml in order to override the original annotation. Looking at the orm.xml schema here it appears that I can't even specify a generation type besides "sequence" and "table".