-->
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: Problem with generating Sequence
PostPosted: Wed Feb 13, 2008 8:03 am 
Newbie

Joined: Wed Feb 13, 2008 7:37 am
Posts: 6
Hi all,

I have a problem with the automatic generation of a Sequence in a Oracle Database.

I have configured a class who uses a component as ID.
I want to use a sequence to raise this ID.

I have configured it as follow:

In my main class (table)

@Entity
@Table(name = "users")
@SequenceGenerator(name = "SEQ_USER_STORE", sequenceName = "user_seq", allocationSize = 2)
public class User{

private UserID m_id;
...

// here also @EmbeddedId is the same result
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_USER_STORE")
public UserID getId()
{
return m_id;
}

}

My component:
@Embeddable
public class UserID{

private Integer m_id;

@Column(name = "id", length = 10)
public Integer getId()
{
return m_id;
}

}

I also have on both classes the methods, hashCode, Equals, toString implemented

in my mapping file (hibernate.cfg.xml) i have
<mapping class="myPackage.User" />
and my oracle connection settings

Now when i run the ant "schema-recreate" from the org.hibernate.tool.ant.HibernateToolTask the table is created succesfully but no sequence.

When i try to add a record i get the message "Id's for this class must be manually assigned before calling the save method"

Can someone help me out of this problem.
Any support wil be appriciated

Thanks in advance

Some details:
Hibernate version:3.2.5

Name and version of the database you are using: Oracle


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 10:24 am 
Newbie

Joined: Wed Feb 13, 2008 7:37 am
Posts: 6
maybe this post is better in the topic tools, so i posted also there ...


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.