-->
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: Specifying schema in orm.xml doesn't apply to sequences?
PostPosted: Thu Jul 03, 2008 3:46 pm 
Newbie

Joined: Thu Jul 03, 2008 1:31 pm
Posts: 1
Hello,

I'm trying to use the orm.xml to specify the schema to use for all my entities. This seems to work for the Table names, but it is not working for my sequences. Some more infomation:

I'm using Oracle 10G and JBoss 4.2.2.

I have an Entity that specifies the following annotations (please excuse any typos...i don't actually have the code in front of me...):

Code:
@Entity
@Table(name="mytable")
@org.hibernate.annotations.GenericGenerator(
    name="my_sequence"
    strategy="sequence"
    parameters = {
        @org.hibernate.annotations.Parameter {
            name="sequence"
            value="my_sequence"

Then
@Id
@GeneratedValue(strategy="GenerationType.SEQUENCE, generator="my_sequence")
@Column(name="id")
private long id;


I've also tried an entity like:
Code:
@Entity
@Table(name="mytable")

Then
@Id
@TableGenerator(name="my_sequence")
@SequenceGenerator(name="my_sequence" sequence-name="my_sequence")
@GeneratedValue(generator="my_sequence")
@Column(name="id")
private long id;


Then in my orm.xml i have:
Code:
<entity-mappings ....>
    <persistence-unit-metadata>
        <persistence-unit-defaults>
            <schema>my_schema</schema>
        </persistence-unit-defaults>
    </persistence-unit-metadata>
    <sequence-generator name="my_sequence" sequence-name="my_sequence"/>
</entity-mappings>


When I run my code, hibernate prepends the schema to my tables, but when I have TRACE turned up, I can see that it is just doing a
Code:
select my_sequence.nextval from dual;
instead of
select my_schema.my_sequence.nextval from dual;


I have tried both with and without the sequence-generator in my orm.xml. Has anyone been able to get this to work with Oracle Sequences or is there something wrong here? Let me know if you see what I'm missing.

Thanks!


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.