All my entities use this type of @Id
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MYENTITY_SEQ")
@SequenceGenerator(name = "MYENTITY_SEQ", sequenceName = "MYENTITY_SEQ")
@Column(name = "MYENTITY", nullable = false)
private Long id;
or
@Id
@Column(name = "MYENTITY")
I find that an Oracle sequence named hibernate_sequence
is always created. Why is this so? And how can I avoid this?
I am using JPA1 with Hibernate 3 and the Oracle 10g dialect.
The HIBERNATE_SEQUENCE is used with REVINFO-entity for creating revision numbers. If you want to use different sequence you should create your custom revision entity.
Help with that: http://docs.jboss.org/hibernate/envers/3.5/reference/en-US/html/revisionlog.html
I see the following code in
org.hibernate.id.SequenceGenerator
:Where the third parameter of
PropertiesHelper.getString(String, Properties, String)
is the default property value.So I'm tempted to say that, somewhere, you have an
Id
not "properly" annotated. Maybe you should perform a little debugging session.I suspect it's because i am using Hibernate Envers as i've double checked my entities and all of them have the correct @Id mappings.