Generating multiplicity annotations during Generate Persistence Mapping?

I plan on purchasing 6.0 because of the EJB 3.0 enhancements. Any chance IDEA could generate the OneToOne, OneToMany, ManyToOne and/or ManyToMany annotations when generating the persistence mapping?

It seems possible based on the foreign key list from the JDBC metadata. I may be hard (or impossible) to predict whether it should be OneToOne versus OneToMany (without actually doing a SQL query on live data), but IDEA could suggest OneToMany and allow the user to change it or not generate it at all. This option could be a fifth column of combo boxes in the "Import database schema" dialog.

1 comment

Another option would be to generate @OneToOne only if there's a unique constraint on the referenced column. Though I don't know wether JDBC allows to query that meta information and if popular JDBC driver really support it.

0

Please sign in to leave a comment.