Hi,
I have written my own IdGenerator:
Code:
public class AkteIdGenerator implements IdentifierGenerator {
public Serializable generate(SessionImplementor session, Object object)
throws HibernateException {
// if custom id is set -> use this id
if (object instanceof SomeBean) {
SomeBean someBean = (SomeBean) object;
Long customId = someBean.getCustomId();
if (customId != 0) {
return customId;
}
}
// otherwise --> call the SequenceGenerator manually
SequenceStyleGenerator sequenceGenerator ...
}
}
Does anyone know how I could call the sequenceGenerator from my generator class what I normally can define per annotations:
Code:
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "MY_SEQUENCE")
@SequenceGenerator(
allocationSize = 1,
name = "MY_SEQUENCE",
sequenceName = "MY_SEQUENCE_NAME")
I would be very thankful for any solutions!!!!
Thanks a lot, Norbert