How do I get Table Metadata with JPA ?

View: New views
2 Messages — Rating Filter:   Alert me  

How do I get Table Metadata with JPA ?

by ajay rs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to get all column's length form database table.
How can I have table metadata ? Is there any method or annotation?

I tried @Column annotaion, but there I have to set these all. But I want original length defined in table structure itself.

Any help regarding this will be appriciated.
Thanks

Re: How do I get Table Metadata with JPA ?

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There is nothing in JPA for this.

You can query your database catalog tables directly using native SQL, or use the JDBC API's directly.

If you are using EclipseLink, there is an API on SchemaManager.getAllColumnNames() that will return the column meta-data from the database.