-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Call a SequenceGenerator manually!
PostPosted: Mon Mar 21, 2011 12:19 pm 
Newbie

Joined: Mon Mar 21, 2011 11:58 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.