I have the following code:
@Entity
@Table(name = "my_table", schema = "my_schema")
@SequenceGenerator(name = "my_table_id_seq", sequenceName = "my_table_id_seq",
schema = "my_schema")
public class MyClass {
@Id
@GeneratedValue(generator = "my_table_id_seq",
strategy = GenerationType.SEQUENCE)
private int id;
}
Database: Postgresql 8.4, Hibernate annotations 3.5.0-Final.
When saving the object of MyClass it generates the following SQL query:
select nextval('my_table_id_seq')
So there is no schema prefix and therefore the sequence cannot be found. When I write the sequenceName like
sequenceName = "my_schema.my_table_id_seq"
everything works.
Do I have misunderstandings for meaning of schema parameter or is it a bug? Any ideas how to make schema parameter working?