Generate persistence mapping by importing database schema 1-n releation

Answered

I have a problem when generating persistence by using hibernate.

Here is a screenshot of my database schema, person has a foreign key which is dept's primary key, person and dept have a N-1 relationship.

This is my import database schema interface:

Here is the generated Person class:

It uses deptId to reference Dept, and it does not generate the ManyToOne and JoinColumn annotation. How do I fix the problem? If it uses ManyToOne the Dept referenced here should be the Dept's object. Any settings I did wrong in the import database schema interface?

3 comments

Looks like https://youtrack.jetbrains.com/issue/IDEA-147717 . Can you try to reproduce the issue and post idea.log?

Try also if it helps to enable Use legacy introspector option in Schemas tab for the Data source.

0

Yes it's similar but mine does not throw an exception, it just does not create the mapping properly.

I have tried enable Use legacy introspector but it does not work.

My version is 15.0.4, is this a known issue?

Here is the log regarding to the problem:

2016-03-22 10:09:01,320 [ 712821] WARN - eration.DatabaseSchemaImporter - relationship "dept_id_fkey" is not properly configured
2016-03-22 10:09:01,320 [ 712821] WARN - eration.DatabaseSchemaImporter - relationship "dept_id_fkey" is not properly configured

That's the foreign key linked from person to dept, I am pretty sure it is property configured in the database.

0
2016-03-22 10:09:01,320 [ 712821] WARN - eration.DatabaseSchemaImporter - relationship "dept_id_fkey" is not properly configured

It is the same as IDEA-147717 issue. It was not yet fixed. Please follow YouTrack issue for updates.

0

Please sign in to leave a comment.