-->
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: Sequence is not created, using Annotations and ant tooltask
PostPosted: Thu Feb 14, 2008 10:31 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 is created.

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, is this a bug or a configuration problem on my side.
Are there any examples for using a component as ID with a sequence?
Any support wil be appriciated.

Thanks in advance

Some details:
hibernate.version=3.2.5
hibernate-annotations.version=3.3.0
hibernate-commons-annotations.version=3.0.0
hibernate-tools.version=3.3.0
database: Oracle 10g
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>


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.