users@jpa-spec.java.net

[jpa-spec users] SQL-Comment support in JPA

From: <dominik.dorn_at_gmail.com>
Date: Sat, 26 Jul 2014 14:27:20 +0000 (UTC)

Hi!

I'd like to propose an enhancement to the JPA Spec.

I'd like to have the JPA annotations (and maybe the xml mappings)
enhanced in a way, that I can add SQL-Comments to it. Implementations
of the spec could then use them add comments to tables, columns etc.
when generating the database schema. These would allow developers to
add semantic information to columns defined by other parts of the
company (which may or may not have ridiculous/non-existing naming
conventions).

I propose to add a field

String comment = "";

to
javax.persistence.Column
javax.persistence.Table
javax.persistence.UniqueConstraint
javax.persistence.JoinColumn (not sure about that one)

The change should be easy to add.. implementations should be free to
implement the feature.
Right now, a comment can be added using the columnDefinition field in
@Column-Annotation, however, this glues the entity to a specific
SQL-implementation because not all SQL-implementations allow to specify
comment-definitions.

Another benefit would be that it could be possible to generate a
database documentation directly from the source that is more
informative than just a COLUMN_NAME : TYPE information.


Please let me know what you think of this enhancement.

Thanks,
Dominik