-->
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.  [ 1 post ] 
Author Message
 Post subject: How to Override the hibernate_sequence?
PostPosted: Mon Mar 07, 2011 5:12 am 
Newbie

Joined: Mon Mar 07, 2011 5:00 am
Posts: 1
Hi all,

I'm using Hibernate annotation to generate sequence number in Oracle 10g database, but i get this error message while trying to insert to the SubClass.

The error message like "SQL Error: 2289, SQLState: 42000 ORA-02289: the sequence does not exist". the sequence named "EBMS_MAX_CAPABILITY_SEQ" was found in DB.

The SuperClass like:

Code:
@MappedSuperclass
public abstract class IdEntity implements Serializable{

   protected Long id;

   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE)
   //@GeneratedValue(strategy = GenerationType.IDENTITY)
   //@GeneratedValue(generator = "system-uuid")
   //@GenericGenerator(name = "system-uuid", strategy = "uuid")
   public Long getId() {
      return id;
   }

   public void setId(Long id) {
      this.id = id;
   }
}


The Subclass like:

Code:
@Entity
@Table(name = "TM_SGM_MAX_CAPABILITY")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@AttributeOverride( name="id", column = @Column(name="MAX_CAPABILITY_ID",insertable=false,updatable=false) )
//@SequenceGenerator(name="myStrategy",sequenceName="EBMS_MAX_CAPABILITY_SEQ")
//@GeneratedValue(strategy = GenerationType.SEQUENCE,generator="myStrategy")
public class MaxCapability extends IdEntity{

   .............
   
   
   @Id
   @SequenceGenerator(name="MY_SEQ",sequenceName="EBMS_MAX_CAPABILITY_SEQ")
   @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="MY_SEQ")
   //@Column( name="MAX_CAPABILITY_ID")
   //@Override
   //public Long getId() {
   //   return id;
   //}
   
   
   .............

}


When i created a sequence named "hibernate_sequence", the program works well. As we known, the default sequence is "hibernate_sequence". Now my concern problem is that it is there have any way to override the "hibernate_sequence" in SubClass?

Any idea? I sorry for any mistakes due to I'm still a newbie here. Anybody can help me to resolve this problem?

Thanks in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.