H2 database create alias for function in package in schema

China☆狼群 提交于 2020-01-02 08:01:33

问题


In my code I call stored procedure like this (and it works perfectly):

{ ? = call schema.package.function(?) }

I need to call it like this because jdbc connection is set to another schema.

But for now I can't test it because H2 database doesn't support packages. So if I change my jdbc url database name to the one I require and delete "schema" from the call everything is ok while testing.

@Test
fun test() {
        val session = em.entityManager.unwrap(Session::class.java)

        session.doWork {
            val st = it.createStatement()
            st.execute("create schema if not exists mySchema")
            st.execute("create alias mySchema.myPackage.myFunction for " // the error happens here  +
                    "\"${this.javaClass.name}.myFunction\"")
        }

        val response = dao.myFunction("1")

        //test stuff


    }

How can I change my test because now it's giving me the syntax error?

来源:https://stackoverflow.com/questions/51287700/h2-database-create-alias-for-function-in-package-in-schema

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!