Hibernate是否完全支持SQLite [英] Does Hibernate Fully Support SQLite

查看:159
本文介绍了Hibernate是否完全支持SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jboss Hibernate没有提供任何有关SQLite支持的信息 -



https://community.jboss.org/wiki/SupportedDatabases2

同样在下面提到SO:



Hibernate + SQLite + Netbeans



您能否为此强调一下?我想使用嵌入式SQLite与休眠摆动桌面应用程序。



我也在评估Derby(JavaDB),因为它也可以嵌入并且是jdk的一部分。



通常,Windows二进制文件在不同的Windows版本上是兼容的 - 只要架构保持不变一样。如果你看 SQLite下载页面,你会注意到有一个32位的预建Windows二进制。这个可以在几乎所有的Windows版本上使用(可能除了Windows RT),但是你不能在Linux或OS X上使用它。为了使用Java的SQLite,你需要为特定的OS /架构,有效地使Java应用程序与平台相关。这是你通常不想要的。



如果你在Swing中构建桌面应用程序,并且你想使用嵌入式数据库,我的建议是使用一个Java嵌入式数据库,例如 H2 HSQL 德比。后者也作为 JavaDB 与Oracle Java一起提供。所有语言都支持hibernate方言(有关方言的完整列表,请参阅方言类: https://github.com/hibernate/hibernate-orm/tree/master/hibernate-core/src/main/java/org/hibernate/dialect

如下面的@akostadinov所述,可能还有其他因素需要考虑,例如SQLite是用本机代码编写的,因此可能有更好的表现。最终,唯一可以决定哪个数据库最好的人是构建系统的人。


Jboss Hibernate doesn't say anything about the support for SQLite -

https://community.jboss.org/wiki/SupportedDatabases2

And same is mentioned in below SO:

Hibernate+SQLite+Netbeans

Can you please highlight about this. I want to use embedded SQLite with hibernate for swing desktop application.

I am also evaluating Derby (JavaDB) as it also can be embedded and is part of the jdk.

解决方案

Since SQLite is an embedded database for C-like environments, written in C and thus compiled to native code, changes that Hibernate (or any ORM) will support aren't really high. Java is cross-platform and it would be a bit weird to have a platform-dependent dependency. On Android, SQLite is used, but there the platform supplies a JDBC driver for it.

Usually, Windows binaries are compatible over different Windows versions - as long as the architecture stays the same. If you look at the SQLite download page you'll notice there's a 32-bit pre-built Windows binary. This one can be used on almost any Windows version (except Windows RT, maybe), but you cannot use it on Linux or OS X. In order to use SQLite from Java, you would need to include the correct binary for the specific OS / architecture, effectively making a Java application platform-dependent. That is something you usually don't want.

If you're building a desktop application in Swing and you want to use an embedded database, my suggestion would be to use a Java embedded database, like H2, HSQL or Derby. The latter is also shipped with Oracle Java as JavaDB. All are supported as hibernate dialects (For a full list of dialects, see the dialect classes: https://github.com/hibernate/hibernate-orm/tree/master/hibernate-core/src/main/java/org/hibernate/dialect)

As noted below by @akostadinov, there may be other factors you want to consider, for example the fact that SQLite is written in native code and hence may have better performance. In the end, the only one who can decide which database is best is the one who is building the system.

这篇关于Hibernate是否完全支持SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆