-->
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.  [ 4 posts ] 
Author Message
 Post subject: Schema export and postgresl sequence
PostPosted: Thu May 13, 2004 5:33 am 
Newbie

Joined: Thu May 13, 2004 5:22 am
Posts: 5
Hi,

I have searched a way to make schema export tool generating this kind of sql command : create table foo (bar integer unique not null
default nextval('foo_bar_seq'), xx VARCHAR(255)); using this declaration :
<class name="foo">
<id name="bar" column="bar" unsaved-value="null">
<generator class="sequence">
<param name="sequence">foo_bar_seq</param>
</generator>
</id>
<property name="xx"/>
</class>

Actually, it doesn't generate the default value.

Thanks.

Ludo.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 5:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
sequence generator reads its next value directly from the sequence, so there is no need to declare such a default. You actually can't have hbm2ddl create that.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 13, 2004 6:08 am 
Newbie

Joined: Thu May 13, 2004 5:22 am
Posts: 5
[quote="michael"]... so there is no need to declare such a default. You actually can't have hbm2ddl create that.[/quote]

Yes there is no need for hibernate, but for other purpose it could.

Thanks.

Ludo.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 4:27 pm 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Sorry there is also no other need. A Sequence is a sequence so there is no need at all to set a default value to a "SERIAL" column because it always has as default value the next number it get from the sequence table. At a look at them and it will point out why there is no need for that.

regards

Olaf


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