-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to use IdentifierGenerator ?Example can't understand!
PostPosted: Mon May 17, 2004 2:04 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Hi everyone:

In a application,I want to use myself identifier ID.So I want to implements the IdentifierGenerator.But I can't understand the example code:

Code:
public class SessionBeanHiLoGenerator implements IdentifierGenerator {

    public Serializable generate(SessionImplementor session, Object object)
        throws HibernateException {
       
        try {
            return HiLoGeneratorUtil.getHome().create().next();
        }
        catch (Exception e) {
            throw new IDGenerationException( "Could not generate id: " + e.getMessage() );
        }
    }

}

what it returned is Serializable? what I expected is that the id generator class will return a String. How to implement my id generator and return String as id?

Please show me a example Thks in advanced!

_________________
You are not alone...


Top
 Profile  
 
 Post subject: about Configurable
PostPosted: Mon May 17, 2004 2:21 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
I had seen many example that implements Configurable interface.Must I implements the Configurable if I want to identify my id generator?

_________________
You are not alone...


Top
 Profile  
 
 Post subject: up
PostPosted: Mon May 17, 2004 7:58 am 
Senior
Senior

Joined: Wed Dec 17, 2003 4:24 am
Posts: 188
Any idea? How to implements the identifierGenerator?

_________________
You are not alone...


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

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.