-->
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: How to specify a schema name for a sequence?
PostPosted: Wed Jun 29, 2005 4:14 pm 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
I'm attempting to use a sequence in a DBMS independent fashion. So far I've tested the following and it works fine with Oracle 9i. The sequence that I'm using is in a schema, so, what I'm doing right now, is prefixing the name of the sequence with the name of the schema followed by a ".". However, I'm wondering if there is a different way to specify the name of the schema similar to how you can specify it using an @Table for an @Entity. This way it will in theory work regardless of the DBMS. i.e. Hibernate will build the fully qualified name using the appropriate separator character.

Note, when I try something similar using Hibernate mapping files, Hibernate automatically uses the schema that I specified for the table/class that the id column appears in. I'm thinking this should be the behavior when using annotations as well?

Also, I'm wondering, what happens to the SequenceGenerator, if I use a different database that supports identity columns instead, for example MSSQL. Is it just ignored (since I'm using GeneratorType.AUTO)?

Hibernate version: hibernate-3.1alpha1, hibernate-annotations-3.1beta3, hibernate-entitymanager-3.1beta1

Mapping documents:

Code:
@Column(name="pk1")
@Id(generate=GeneratorType.AUTO,
   generator="calendarItemSequenceGenerator")
@SequenceGenerator(name="calendarItemSequenceGenerator",
   sequenceName="bb_bb60.calendar_seq")
public int getId() {
   return id;
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 01, 2005 9:38 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've forwarded your case to the Expert group.
When declaring AUTO, the generator parameter is ignored if Identity is finally used.

_________________
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.