Trouble generating persistence mapping from postgres with auto increment

Hi, this is my first time trying out intellij and also hibernate/jpa. I have been trying to use the built in tools for creating a peristence mapping from my postgresql database to jpa models.

Each of my tables in the database has an auto increment id (serial type). When I go to NewPersistenceUnit -> Generate persistence mapping by database schemea intellij creates models for each of the id sequences. If I run a test class creating an entity manager it crashes saying the id squences tables dont have primary keys.

If I delete the generated id sequence models it all runs find but there seems to be nothing linking the sequence to the entity. To get this part to work I have to manually go into every model with a auto increment id and say this id is using this sequence from the database.

If I run exactly the same database setup from mySQL no id sequence tables are created and the created entities link to the sequences fine with no manual input.

So is this a bug with intellij or something I am doing wrong. Why are models being created for each sequence?

Thanks

Charles

Please sign in to leave a comment.