Hibernate version: 3.2.6.GA
Mapping documents:none -> using Annotations
Code between sessionFactory.openSession() and session.close():everything fine here
Full stack trace of any exception that occurs:no error no exception
Name and version of the database you are using:PostgreSQL 8.3
I have a small test project in Hibernate to learn the basics. I make use of Annotations and i want to autogenerate the ids of 4 tables with:
Code:
@GeneratedValue(strategy=GenerationType.AUTO)
That works fine in MySQL but creates only 1 sequence in PostgreSQL with the following effect:
enter object1 of type 1 --> ID 1
enter object2 of type 2 --> ID 2 (and not 1 as expected)
enter object3 of type 3 --> ID 3 (and not 1 as expected)
enter object4 of type 1 --> ID 4 (instead of 2)
I also tried own sequence generators which worked fine for Postgre but didn't work in MySQL (since there are no sequences in MySQL). I want to keep the whole project as generic as possible. Are there any tricks for using the
Quote:
GenerationType.AUTO
with PostgreSQL
Thx in advance[/b]