cssxsh / mirai-hibernate-plugin

Mirai Console Hibernate/ORM 数据库前置插件
GNU Affero General Public License v3.0
31 stars 1 forks source link

关于sqlite方言问题 #21

Closed Moyuyanli closed 10 months ago

Moyuyanli commented 10 months ago

我在进行sqlite数据库连接时, 通过以下配置

properties.setProperty("hibernate.connection.url", SQLITE_BASE_PATH);
//        properties.setProperty("hibernate.dialect", "org.hibernate.dialect.SQLiteDialect");
        properties.setProperty("hibernate.connection.driver_class", HIBERNATE_CONNECTION_DRIVER_CLASS_SQLITE);
        properties.setProperty("hibernate.connection.provider_class", "org.hibernate.hikaricp.internal.HikariCPConnectionProvider");
        properties.setProperty("hibernate.connection.isolation", "1");
        properties.setProperty("hibernate.hbm2ddl.auto", "update");
        properties.setProperty("hibernate-connection-autocommit", "true");

进行链接 会报错 Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: INFORMATION_SCHEMA.SEQUENCES) 具体问题貌似是hibrnate在进行数据库更新时会扫描INFORMATION_SCHEMA.SEQUENCES表,但是sqlite没有这个表。 我尝试过关闭扫描 properties.setProperty("hibernate.id.new_generator_mappings", "false"); 但是一样报错, 搜索得到需要sql方言支持,也就是上面配置中我注掉的信息。 再尝试后报没有找到sql方言 查看本插件的build.gradle.kts,确实没有引入方言

implementation("org.hibernate:hibernate-dialects:x.x.x")

希望你能尝试一下