[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-354?page=co...
]
Emmanuel Bernard commented on ANN-354:
--------------------------------------
I already commented on it, use allocationSize=1 and no this is not a bug
@javax.persistence.SequenceGenerator defaults to 'seqhilo'
strategy.
--------------------------------------------------------------------
Key: ANN-354
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-354
Project: Hibernate Annotations
Issue Type: Improvement
Affects Versions: 3.2.0.cr1
Reporter: Andrey Petrov
When using an oracle-style sequence to auto generate primary key values like this:
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MySeq")
@SequenceGenerator(name="MySeq", sequenceName="ORACLE_SEQ")
public long getId() {
return id;
}
then a org.hibernate.id.SequenceHiLoGenerator is always used.
There should be a way to configure a different generator!
Since the hilo generator is not suitable for my application I have to use this instead:
@Id
@GeneratedValue(generator="MySeq")
@GenericGenerator(
//this is a hibernate-specific hack to force the use of a regular sequence
generator
//otherwise a sequencehilo generator is used by default :-(((
name = "MySeq", strategy = "sequence", parameters = {
@Parameter(name = "sequence", value = "ORACLE_SEQ")
}
)
public long getId() {
return id;
}
Now this works fine and while this solution can be tolerated for my app I really wish
there was another way to control the default generator strategy (sequencehilo or plain
sequence) without resorting to hibernate-specific
org.hibernate.annotations.GenericGenerator annotations.
Do you think a mechanism for configuring that can be added to a future hibernate
annotations version?
p.s.
as long as i can see the seqhilo generation strategy is hardcoded in:
org.hibernate.cfg.AnnotationBinder.java:1925: case SEQUENCE:
org.hibernate.cfg.AnnotationBinder.java:1926: return "seqhilo";
(in hibernate annotations version 3.2.0.cr1)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira