问题标签 [dialect]

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 投票
0 回答
80 浏览

spring - 从百里香处理器中省略方言前缀

有没有办法从百里香处理器中省略方言前缀?假设我定义了一个这样的处理器:

有没有办法修改方言类以便能够以这种方式使用标签:

0 投票
1 回答
587 浏览

eclipse - 休眠代码生成:org.hibernate.HibernateException:没有可用连接时必须设置“hibernate.dialect”

我在 Eclipse Mars 中尝试使用 Hibernate Tool Code generation 时遇到了这个问题。我已经有方言hibernate.cfg.xmlsqljdbc4.jar包括在内。

org.hibernate.HibernateException: 'hibernate.dialect' enter code here must be set when no Connection available


休眠.cfg.xml


休眠.reveng.xml

0 投票
1 回答
233 浏览

java - 在 Hibernate 方言中引用关键字

我正在尝试编写引用单词定义的 Hibernate 方言。

我试图覆盖 Dialect.quote 函数,但它是最终的并且不允许这样做。

目前 Hibernate 生成这个:
select ..., postingdef0_.definition as definition31_, ... from ...

我需要它是: select ..., postingdef0_."definition" as definition31_, ... from ...

请注意单词定义周围的引号。

我还尝试将定义注册为关键字( registerKeyword )但没有成功。

在更改客户端代码以添加反引号之前,我想在方言中解决此问题,这似乎是替代解决方案。

0 投票
1 回答
4321 浏览

c# - Questions about Dapper SQL queries and parameters with PostgreSQL

I´m currently learning about Dapper. I have searched a lot here and other places (including this) and I could not find concrete answers to my doubts:

¿Does Dapper use a generic SQL dialect or it's specific for DB engine? I mean, it uses the SQL syntax expected in the underlaying database engine? At first and after reading over a dozen of examples I thought that the SQL queries where generic, but now trying on PostgresSQL ODBC I have encountered problems with syntax and parameters.

Using this example POCO class ...

... the following line does not work for me:

First, this line trows an ODBC exception beacuse expects the clause "INTO" before specifying the table. Also the parameters does not work either, because if I'm not wrong, PostgresSQL parameters are setted with the "?" symbol and not with "@keyword". On the GitHub page we can find this:

Dapper has no DB specific implementation details, it works across all .NET ADO providers including SQLite, SQL CE, Firebird, Oracle, MySQL, PostgreSQL and SQL Server.

So I'm lost with this. :) After experimenting a lot I found that putting all the PostgresSQL things works as expected. For example all the next cases worked:

These previuos cases worked fine. But I'm confused at understanding if the SQL queries are a generic SQL dialect or an specific database engine dialect.

Also I've tried out Dapper.Contrib and fails too with the INSERT statement, for example:

It fails too...a weird "[" character exception.

What I'm doing wrong?

My regards!

0 投票
3 回答
7655 浏览

hibernate - 无法解析名称 org.hibernate.dialect.SQLiteDialect

上周我说“让我们试试 WildFly 10!” 在基本配置和 HelloWorld 内容之后,我想看看持久性是如何工作的。A 拿了我的旧 ABC EAR 有一个 JPA 模块,其中 Hibernate 与 SQLite 一起使用。我设置了net.kemitix提供的方言。

所以,我在 POM 文件中设置了它的依赖关系:

打包后的 EAR 看起来像这样:

持久性.xml:

在部署过程中出现以下异常:

我还尝试将包含方言的 JAR 与驱动程序本身一起加载,但结果相同:

C:\wildfly-10.0.0.Final\modules\system\layers\base\org\xerial\sqlite-jdbc\main\module.xml

有人可以解决这个问题吗?同时,我将再次阅读 WildFly 文档中的相关部分 :-)

最好的问候, Kérdezösködő 印度

0 投票
1 回答
82 浏览

java - 在程序中向 Java 语言添加不可变的编程规则

我正在用 Java 编写程序。我发现当范式技术一致时,阅读和调试代码是最容易的,这让我可以非常快速地假设问题出在哪里以及是什么问题。

正如您可能猜到的那样,这样做使我的编程速度更快,因此我想找到一种方法来执行这些规则。

例如,假设我有一个方法可以更改对象的状态并返回一个值。如果在类之外调用该方法,我不想看到它在参数括号内解析,如下所示:

相反,我希望它像这样完成:

另一个例子是,我想创建一个包含某些打印方法的基类,并且我希望用户定义的所有类都从该基类派生,就像 java 所做的那样。

在我的对象中,有没有一种方法可以强迫自己(和其他任何人)遵守这些规则?IE。如果您尝试运行违反规则的代码,它将终止并返回自定义错误报告。另外,如果您编写的代码违反了规则,IDE(我使用 eclipse)会将其识别为错误,加下划线并调用相应的 javadoc?

0 投票
1 回答
821 浏览

spring - sec:authorize 未在 spring-boot 项目上进行评估

在我当前的 spring-boot 项目中,我对这个 html 代码有一个看法:

但是当我执行应用程序时,显然sec:authorize没有评估标签,因为这两个部分都在显示。

我以这种方式在 application.properties 文件中配置 thymeleaf:

我的百里香配置类是这样实现的:

任何人都可以指出我在这里缺少什么?

0 投票
1 回答
1551 浏览

java - 在 Grails 中使用 listAgg 和 H2 db

我有一个 grails 应用程序。我们支持 Oracle 数据库和 H2 数据库。

我在 prod 上使用 Oracle 11g DB,在开发环境上使用 H2 DB。我有带有“listAgg”功能的休眠查询。它在 Oracle 上运行良好。但是H2不支持这个功能。我还能做些什么来将此功能与 H2 一起使用?

我认为可以通过自定义方言来完成。但我不明白怎么做。谁能详细解释一下?

我看到 H2 具有类似于 listAgg 的“group_concat”功能。我可以配置我的应用程序,以便将“group_concat”用于 H2DB 而不是 listAgg。

圣杯 2.3.11。

非常感谢!

0 投票
1 回答
299 浏览

spring - spring-boot 项目不评估 thymeleaf 自定义处理器

出于某种原因,我当前的 spring-boot 项目没有评估我的自定义 thymeleaf 标签。我在我的应用程序类中注册了这样的方言:

方言以这种方式引用处理器:

但是当我用这样的代码打开一个页面时:

处理器没有被评估为最终代码。任何人都可以看到这里有什么问题吗?这在这个项目中起作用,突然(经过一些改变,我不记得发生了什么)停止工作。

0 投票
1 回答
464 浏览

java - 在没有方言类的情况下向 JPA/Hibernate 注册 SQL 函数

我在尝试计算 Hql 中两个日期之间的持续时间时遇到了困难,所以我在一篇文章中读到我必须使用自定义方言注册 hql 功能,但问题是我正在开发一个开源项目,我不想附加到特定的 DBMS 实现,

所以现在我正在尝试将 SQL 函数注册到休眠配置Configuration.addSqlFunction(...) 中,但我不知道如何在应用程序启动时获取我的配置对象。

这是我如何初始化休眠