Hibernate: can I override an identifier generator using XML with a custom generator?
Posted
by Ken Liu
on Stack Overflow
See other posts from Stack Overflow
or by Ken Liu
Published on 2010-03-23T20:42:32Z
Indexed on
2010/03/23
20:43 UTC
Read the original article
Hit count: 385
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".
© Stack Overflow or respective owner