-->
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.  [ 6 posts ] 
Author Message
 Post subject: Using a named sequence
PostPosted: Tue Apr 18, 2006 11:52 am 
Newbie

Joined: Fri Mar 24, 2006 5:10 pm
Posts: 7
I'm using Oracle, and I have sequences per entity that I have named. I'm using hibernate-annotations-3.1beta8.

The sequence I created in the database as such:

create sequence seq_parmid;

I'm guessing on how to use this named sequence, but this seems to be what I want to do:

@Entity
@SequenceGenerator(name="seq_parmid", sequenceName="seq_parmid")
public class ComponentParm implements Serializable {
/**
* Constructor for serialization.
*/
public ComponentParm() {
}

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq_parmid")
public Long getParmid() {

...

I'm doing it wrong because this doesn't work for me. I get a null pointer exception when trying to save a record of this type, so I'm assuming the parmid is gotten and is returning null, etc.

What should I be doing instead?

Thanks in advance,
Scott


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 3:52 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Few issues before: http://forum.hibernate.org/viewtopic.php?t=958128

Search the forum next time, it is useful.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 6:34 am 
Newbie

Joined: Fri Mar 24, 2006 5:10 pm
Posts: 7
Thanks for the answer, but I have to say, this is the second time that I've gotten attitude for posting here. I did search before posting, and I didn't find the answer I was looking for. Being new to a product is a challenge; being slapped for asking a question is discouraging to say the least. Thanks for the help people, but I won't be back.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 6:38 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Did it help or not?

How did you search if you didn't find that issue?

And don't be a cry baby, for a simple instruction to search better.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:33 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
calm down everybody, take a deep breath and do a kiss on the cheek :-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 6:50 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
:-)


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