Play2's anorm can't work on postgresql

后端 未结 1 1756
臣服心动
臣服心动 2021-02-07 09:46

I found that the row parsers of play2\'s anorm depend on the meta data returned by jdbc driver.

So in the built-in sample \"zentasks\" provided by play, I can find such

1条回答
  •  抹茶落季
    2021-02-07 10:29

    The latest play2(RC3) has solved this problem by checking the class name of meta object:

    // HACK FOR POSTGRES
    if (meta.getClass.getName.startsWith("org.postgresql.")) {
      meta.asInstanceOf[{ def getBaseTableName(i: Int): String }].getBaseTableName(i)
    } else {
      meta.getTableName(i)
    }
    

    But be careful if you want to use it with p6spy, it doesn't work because the class name of meta will be "com.p6spy....", not "org.postgresql....".

    0 讨论(0)
提交回复
热议问题