Java中的DataSet类?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1194971/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:45:56  来源:igfitidea点击:

DataSet class in Java?

javadataset

提问by User1

Does anyone know if there is a DataSet class in Java like there is in .Net? I am familiar with EJB3 and the "java way" of doing data. However, I really still miss the seamless integration between database queries, xml and objects provided by the DataSet class. Has anyone found a Java implementation of DataSet (including DataTable, DataRow, etc)?

有谁知道 Java 中是否有像 .Net 中那样的 DataSet 类?我熟悉 EJB3 和处理数据的“java 方式”。但是,我还是很怀念DataSet 类提供的数据库查询、xml 和对象之间的无缝集成。有没有人找到 DataSet 的 Java 实现(包括 DataTable、DataRow 等)?

Edit: Also if anyone has tutorials for the java flavor of DataSet, please share a link.

编辑:另外,如果有人有关于 DataSet 的 Java 风格的教程,请分享链接。

采纳答案by Nick Holt

Have you looked at javax.sql.rowset.WebRowSet?

你看过javax.sql.rowset.WebRowSet吗?

From the Javadocs:

来自 Javadocs:

The WebRowSetImpl provides the standard reference implementation, which may be extended if required.

The standard WebRowSet XML Schema definition is available at the following URI:

   http://java.sun.com/xml/ns/jdbc/webrowset.xsd

It describes the standard XML document format required when describing a RowSet object in XML and must be used be all standard implementations of the WebRowSet interface to ensure interoperability. In addition, the WebRowSet schema uses specific SQL/XML Schema annotations, thus ensuring greater cross platform inter-operability. This is an effort currently under way at the ISO organization. The SQL/XML definition is available at the following URI:

   http://standards.iso.org/iso/9075/2002/12/sqlxml

WebRowSetImpl 提供了标准参考实现,如果需要,可以对其进行扩展。

标准 WebRowSet XML 架构定义在以下 URI 中可用:

   http://java.sun.com/xml/ns/jdbc/webrowset.xsd

它描述了在 XML 中描述 RowSet 对象时所需的标准 XML 文档格式,并且必须用于 WebRowSet 接口的所有标准实现以确保互操作性。此外,WebRowSet 模式使用特定的 SQL/XML 模式注释,从而确保更大的跨平台互操作性。这是 ISO 组织目前正在进行的一项工作。SQL/XML 定义在以下 URI 中可用:

   http://standards.iso.org/iso/9075/2002/12/sqlxml

回答by Markus Koivisto

ResultSetlike rexem commented above. Would you like to elaborate on what you consider the Java way of doing data and how it differs from the C# way?

ResultSet就像上面评论的 rexem。您想详细说明您认为 Java 处理数据的方式以及它与 C# 方式的区别吗?

回答by MexicanHacker

I know what you mean by the "dataset way" maybe you can find something similar, however are you sure you want to go that way? Java has many options but if you want something more cooked, why don't explore hibernate, it's the very popular in the industry and will give you more power that the one you are asking for.

我知道您所说的“数据集方式”是什么意思,也许您可​​以找到类似的东西,但是您确定要那样做吗?Java 有很多选择,但是如果您想要更成熟的东西,为什么不探索 hibernate,它在行业中非常流行,并且会为您提供比您所要求的更强大的功能。

回答by Axl

You might be looking for LINQ implementation in Java. IMHO better than the DataSet/DataTable route.

您可能正在寻找 Java 中的 LINQ 实现。恕我直言,比 DataSet/DataTable 路线更好。

http://code.google.com/p/jaque/

http://code.google.com/p/jaque/

http://quaere.codehaus.org/

http://quaere.codehaus.org/

Disclaimer: I haven't used either of these.

免责声明:我没有使用过这些。

回答by jli_123

you may want to look into this open-source library:

你可能想看看这个开源库:

https://www.developerfusion.com/project/20506/casperdatasets/

https://www.developerfusion.com/project/20506/casperdatasets/

Its easy to use (a lot like using the sql resultset), and its all in-memory. it also supports complex queries and indexes on your data.

它易于使用(很像使用 sql 结果集),并且全部在内存中。它还支持对数据进行复杂的查询和索引。

回答by robocik

I'm an author of ExDataSet. If you need a way to send DataSet from java/android application to .NET the web service, you should take a look on this library. It is 100% fully compatible in xml representation with .NET DataSet objects and supports sending tables, rows, relations, foreign and unique keys, nested tables etc.

我是ExDataSet的作者。如果您需要一种将数据集从 java/android 应用程序发送到 .NET 网络服务的方法,您应该看看这个库。它在 xml 表示中与 .NET DataSet 对象 100% 完全兼容,并支持发送表、行、关系、外键和唯一键、嵌套表等。

回答by Fandi Susanto

Made one myself. Only have DataTable and DataRow, and might be incomplete. Check:

自己做了一个。只有DataTable和DataRow,可能不完整。查看:

https://github.com/fandisus/javatrustlib

https://github.com/fandisus/javatrustlib