问题标签 [kotlin-exposed]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
12750 浏览

kotlin - 有没有办法用 Kotlin 的 Exposed 库运行原始 sql

我正在尝试运行一些特定于 postgres 的 sql,并希望在 Exposed 中重用事务管理。

0 投票
1 回答
3647 浏览

spring-boot - 在 Spring Boot 中暴露的 SQL 日志记录

如何在 Spring Boot 中启用 Exposed 生成的 sql 查询的日志记录?

以下不起作用:logging.level.org.jetbrains.exposed.sql:调试 logging.level.org.jetbrains.exposed:调试

0 投票
1 回答
1847 浏览

maven - Maven 导入依赖 Jetbrains Exposed

在 Jetbrains 的 Exposed,一个 Kotlin SQL 框架的 github 页面上,有一个链接到一个页面,您可以在其中获取该库的 maven 依赖项 ( https://bintray.com/kotlin/exposed/exposed/view# )。同样的依赖也可以在 MVNRepository ( https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed/0.7.6 ) 上找到。

我正在使用 maven 3.3.9 和 Intellij 2016.3.4,但 maven 无法解决这种依赖关系。我检查了 ~/.m2/ 目录,它似乎已下载(存在一个 jar)。查看存储库后,我发现没有 pom.xml 并且他们使用 Gradle。

是否仍然可以使用 maven 导入此依赖项?

0 投票
1 回答
2112 浏览

kotlin - 使用 Exposed 时出现 NoClassDefFoundError

我使用Exposed作为我的数据库库,当我尝试运行我的代码时出现这些错误:

代码片段SQLObjects.kt

我想我正确地遵循了示例代码,但我无法弄清楚是什么引发了这些。

0 投票
3 回答
3512 浏览

transactions - Kotlin Exposed 不提交事务

按照Exposed上提供的示例,我无法在创建它的事务之外读取创建的表/数据。我正在使用 h2-in-memory 数据库。

例外是:

我添加了一个提交的调用,但这没有帮助。如果我在创建数据的事务中读取数据,如 github 链接上的示例所示,它可以正常工作。这是它的简化版本:

我怎样才能持久化数据?

添加logger.addLogger(StdOutSqlLogger)给出以下输出:

0 投票
5 回答
3976 浏览

postgresql - 如何通过 Kotlin Exposed ORM 使用 Postgresql 枚举类型?

我已将一些 Postgresql 类型作为扩展添加到 Exposed。它有两个现成的类型,名为enumerationenumerationByName。我对它们进行了测试,但没有成功将 postgre 枚举类型映射到 Kotlin 枚举类。在阅读和写作中都会引发错误

阅读时:

0 投票
3 回答
2994 浏览

asynchronous - 我可以将 Ktor 与 Exposed 混合使用吗?

我正在使用 Ktor 和 Exposed ORM 编写服务,这显然不是异步的。我来自 Python 世界,然后回到那里使用带有异步 IO 库的阻塞 ORM 是一种罪过,因为它可能会阻塞线程中的所有用户。同样的规则是否适用于 Kotlin?我在创建一个糟糕的架构吗?

0 投票
1 回答
1450 浏览

gradle - 带有 Gradle 构建的 Kotlin Require 库

我正在尝试将库Exposed添加到我的项目中。所以,它把我带到了它说使用的 bintray 页面compile 'org.jetbrains.exposed:exposed:0.8.5'。我打开我的文件build.gradle并将该文件放入dependencies段中:

IntelliJ 自动构建它,我收到以下错误

警告:根项目“DB-Table-To-Orm”:无法构建 Kotlin 项目配置详细信息:java.lang.reflect.InvocationTargetException:null 原因:org.gradle.api.artifacts.ResolveException:无法解析所有依赖项配置':compileClasspath'。原因:org.gradle.internal.resolve.ModuleVersionNotFoundException:找不到 org.jetbrains.exposed:exposed:0.8.5。在以下位置搜索: https ://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.pom https://repo1.maven.org/maven2/org /jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.jar 要求:项目:

因此,我查看了存储库jetbrainsexposed目录之外没有其他路径。

如何使用 Gradle 安装 Exposed 库?他们的路径写错了吗?我应该在项目中提交错误报告吗?还是我只是将compile声明放在错误的位置?

抱歉,如果这似乎是一个愚蠢的要求,我是JavalandandKotlin的新手IntelliJ。为.NET世界而来。

更新

以下是build.gradle全文:

0 投票
1 回答
2673 浏览

json - Exposed: How to parse JSON into an Entity class

I have the following user table object & entity class:

Is there a way to use Gson (or some other library) to parse JSON into a User instance, and then insert it? From what I can tell, it seems like I'll have to create an intermediate UserData data class and then manually copy the fields over.

It's not that bad in this contrived example, but I'm wondering if there's a dry'er approach.

0 投票
1 回答
3508 浏览

java - 如何在 Intellij 中将 Kotlin 与 H2 和 SQLite 结合使用

当我尝试在 Intellij 中使用带有 SQLite 或 H2 的 Kotlin 时,Intellij 给了我这个错误:

这是我的 Gradle 文件:

这是我的 Kotlin 文件,我在其中尝试使用Exposed与 H2e 交互,并使用 Kotlin 进行一些数据持久性:

如何将 Kotlin 与数据库一起使用?这不适用于 Android;只是 Intellij 中的一个个人项目,我最终想在 PC 上使用。