Map database type to concrete Java class

## Background Map a column data type to its corresponding Java class. ## Problem A query returns meta information from a database: SELECT rb.object_schema, rb.object_name, rb.column_name FROM dictionary.resource_bundle rb For example, this query returns (the self-referential): dictionary, resource_bundle, column_name Where 'dictionary' is the schema name, 'resource_bundle' is the object_name, and 'column_name' is the column_name. It would be great to do something like: SELECT rb.object_schema, rb.object_name, rb.column_name, rb.column_type FROM dictionary.resource_bundle rb And have this query return: dictionary, resource_bundle, column_name, varchar Then use JDBC to discover that `varchar` is [mapped][1] to `java.lang.String`. ## Questions 1. In PostgreSQL, how do you determine what type is used to store the data, given a schema name, object name (guaranteed to be table or view), and column name? 1. In a database-neutral fashion (leveraging JDBC), how do you determine the mapping a database uses for a given data type? [1]: http://archives.postgresql.org/pgsql-jdbc/2010-10/msg00062.php

以上就是Map database type to concrete Java class的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏