JPA for querying in-memory data
During an import procedure, I read tabular data from excel sheets. I want to perform some operation on this data: I want to sort, search by key, filter etc. Is it possible to reliably perform this kind of operations via JQL? thanks
I would use Space4J and simple Collections for something like this.
Personally I think all these ORM abstractions and layers are a distraction at the small scale problem domains, and are inflexible and added complexity at the other extreme.
You could use an in-memory database like HSQLDB, fill it, then use JPA to query the data. But wouldn't using some Maps and Lists be sufficient?
DataNucleus has its own in-memory query evaluator for JDOQL and JPQL syntaxis. I've never used it outside of a full JDO / JPA persistence environment but there's no real reason why it couldn't be made to work with a little coding
If you are using EclipseLink, you can execute most queries in memory against the cache.
You just need to read everything into the cache they execute a JPQL or Criteria query with the "CheckCacheOnly" option.
See, http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Query_Options
精彩评论