English 中文(简体)
Is there anything like .NET DataView/ DataSet for Java, where I can snapshot some data and then perform queries on it?
原标题:

Context

In our application, we snapshot data from a database using a query that is entered by a super user, and then we save the data from that snapshotting using XML. If I was using .NET, I would use a DataSet (+ DataTables) and DataViews, which are pretty good for that purpose. But I am in the Java world, and my impulse choice was to store the snapshotted data using XML (this can be easily changed at this phase of the project).

Question 1

Is there anything that allows you to snapshot data without having to create its structure first for the Java platform, like a DataSet would do for .NET, and that would allow to perform queries on that data later? I thought about storing it in the database or using Apache Lucene, but for both approaches I would have to manage the database structure, which I would prefer not doing.

Question 2

Supposed you have the following XML:

<data>
<record>
   <user>ravi</user>
   <age>32</age>
   <city>calgary</city>
</record>
<record>
   <user>spiderman</user>
   <age>68</age>
   <city>new york</city>
</record>
</data>

And, on that data, I would execute the following query:

age > 50 or city =  new york 

The result of that operation would be a subset of the original XML only with the records that match the conditions in the query.

Thanks!

最佳回答

There is something a bit similar called a RowSet, which is part of the JDBC spec. You can get data and cache them in a CacheRowSet that you can manipulate or even update later. Seems like there is also a FilteredRowSet, so that you can create view that shows only the data you want.

This looks relatively similar to ADO.NET DataView and DataSet. Note also that RowSet are not popular in Javaland.

A few more pointers:

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签