Java中的DataTable等价物
在 Java 中是否存在等效的 C# DataTable?
Is there a C# DataTable equivalent in Java?
推荐答案
一个已被问到的类似问题最近.ResultSet 当然不是直接等效的,因为它只适用于与数据库的活动连接,而 DataTable 可以离线"使用.
A similar question that has been asked recently. ResultSet certainly is not a direct equivalent as it only works with an active connection to the database while a DataTable can be used "offline".
根据个人经验,我会说 Java 中没有直接的等价物(虽然没有尝试过 javax.sql.rowset.WebRowSet
).您要么使用纯 SQL,而 java.sql.ResultSet
是您的朋友.或者您使用一些 ORM 工具,例如 Hibernate、Cayenne、Toplink 等等.或者您自己构建(不是我鼓励这样做,但我认为已经成功完成的项目不止一个).
From personal experience I would say there is no direct equivalent in Java (haven't tried javax.sql.rowset.WebRowSet
, though). You either go with plain SQL and java.sql.ResultSet
is your friend. Or you use some ORM tool like Hibernate, Cayenne, Toplink to name a few. Or you build your own (not that I encourage this, but I think on more than one project that has been done successfully).
相关文章