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!