Kotlin H2数据库为架构中的包中的函数创建别名

Kotlin H2数据库为架构中的包中的函数创建别名,kotlin,h2,Kotlin,H2,在我的代码中,我这样调用存储过程(它工作得很好): {?=调用schema.package.function(?)} 我需要这样称呼它,因为jdbc连接被设置为另一个模式 但现在我不能测试它,因为H2数据库不支持包。因此,如果我将JDBCURL数据库名称更改为所需名称,并从调用中删除“schema”,测试时一切正常 @Test fun test() { val session = em.entityManager.unwrap(Session::class.java)

在我的代码中,我这样调用存储过程(它工作得很好):

{?=调用schema.package.function(?)}

我需要这样称呼它,因为jdbc连接被设置为另一个模式

但现在我不能测试它,因为H2数据库不支持包。因此,如果我将JDBCURL数据库名称更改为所需名称,并从调用中删除“
schema
”,测试时一切正常

@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


    }

如何更改我的测试,因为现在它给了我语法错误?

你能添加错误输出吗?你解决了这个问题吗?@KumaresanPerumal否,Sorry我仍然在寻找。