我是否需要在Maven依赖项中指定PostgreSQL方言?

时间:2016-02-07 12:43:08

标签: hibernate postgresql maven

我正在读一个朋友课程,以便更好地了解Maven。他正在使用SQLite。他在Maven项目中有这些依赖项:

<dependency>
    <groupId>org.xerial</groupId>
    <artifactId>sqlite-jdbc</artifactId>
    <version>3.8.11.2</version>
</dependency>
<dependency>
    <groupId>net.kemitix</groupId>
    <artifactId>sqlite-dialect</artifactId>
    <version>0.1.0</version>
</dependency>

我希望自己能够使用PostgreSQL。到目前为止,我已添加:

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-901-1.jdbc4</version>
</dependency>

但是,我是否可以在SQLite中看到与PostgreSQL方言无关的依赖关系?或者它是否包含在上面的PostgreSQL依赖中?

1 个答案:

答案 0 :(得分:1)

似乎net.kemitix:sqlite-dialect是一个用于Hibernate的依赖项:

  

Hibernate的SQLite方言

这是因为Hibernate does not support SQLite databases out of the box:我们需要明确地添加一个方言(也就是Hibernate与数据库进行通信和理解的方法)。

幸运的是,如果你想使用PostgreSQL,Hibernate支持它和there are already built-in PostgreSQL dialects。因此,您不需要添加另一个依赖项:PostgreSQL驱动程序就足够了。