-->
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.  [ 2 posts ] 
Author Message
 Post subject: PostreSQL, GeneratorType.AUTO and schema generation
PostPosted: Thu Nov 24, 2005 9:16 am 
Newbie

Joined: Thu Nov 24, 2005 8:48 am
Posts: 10
Hello,

I am very new to Hibernate so my question might be stupid but I don't understand the @Id(generate=GeneratorType.AUTO) usage when using PostgreSQL. I thought that schema generation should generate autoincrement feature (sequence) in my PostgreSQL database for the id in the table but nothing such happens. Autoincrement sequence is created only when using GeneratorType.IDENTITY.

What should I do to get the autoincrement feature created for my id field in table using GeneratorType.AUTO and PostgreSQL? I would like to use GeneratorType.AUTO because Hibernate documentation states that it is "the preferred type for portable applications".

I use:
hibernate-3.1rc2
hibernate-annotations-3.1beta6
hibernate-entitymanager-3.1beta4

Thanks for any suggestion.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 25, 2005 8:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
the primary generator for postgres is Sequence not identity.
If you want to change that, update the postgres dialect getNativeIdentifierGeneratorClass()

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.