I'm working with Hibernate 4.2.x and I want to disable the HiLo sequence generation - go to the DB (oracle) every time. I added this row to the persistance.xml:
<property name="hibernate.id.new_generator_mappings" value="true"/>
And my entity looks like this:
@Entity
@Table(name = "MY_TABLE")
@SequenceGenerator(name = "generator", sequenceName = "MY_SEQ", initialValue = 1, allocationSize = 1)
public class MyEntity {
private long id;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
public Long getId()
{
return id;
}
}
For some reason I still getting HiLo behavior - ids created far away from each other.
Looked on some questions (here and here for example), but didn't find anything helpful. More ever, I couldn't find where to configure which Optimizer to use.