views:

24

answers:

1

... right now, this is how I'm getting the id from save(entity) method:

        Serializable save = hibernateTemplate.save(article);
    return Integer.valueOf(save.toString());

Being a complete noob to hibernate, I just wonder if this is the proper way to do it? I'll appreciate any advice.

Grateful in advance :-)

+1  A: 

I think it is unnecessary to use Integer.valueOf(save.toString); because you know type of your identifier and Hibernate of course too. You can use (Integer)save.

MarrLiss
... Thanks a bunch!
vector