persistence

RavenDB how to flush?

杀马特。学长 韩版系。学妹 提交于 2019-12-18 13:25:14
问题 I am using RavenDb embedded. As a part of my intergration tests I want to check objects are persisted. When I SaveChanges on an object, then retrieve it, it cannot be found unless I dispose my connection. This does not work for me, as no files are returned using (var session = _dataDocumentStore.Instance.OpenSession()) { session.Store(file); session.SaveChanges(); } .... using (var session = _dataDocumentStore.Instance.OpenSession() ) { return session.Query<File>().ToList(); } I created a

How to store persistent data easily without using databases?

a 夏天 提交于 2019-12-18 12:37:29
问题 I'm trying to use Android Application class (MyApplication.java) for storing data in some ArrayLists of strings and ints. I want that these data get's stored forever, like a database, but without using databases , to simplify my app. Currently the data get's stored, when I exit from the app, the process of the app still runs in background. But if I kill the process of the app, the data stored on MyApplication.java class get's removed. So I need some kind of function that stores the data from

Shelve is too slow for large dictionaries, what can I do to improve performance?

半城伤御伤魂 提交于 2019-12-18 11:40:06
问题 I am storing a table using python and I need persistence. Essentially I am storing the table as a dictionary string to numbers. And the whole is stored with shelve self.DB=shelve.open("%s%sMoleculeLibrary.shelve"%(directory,os.sep),writeback=True) I use writeback to True as I found the system tends to be unstable if I don't. After the computations the system needs to close the database, and store it back. Now the database (the table) is about 540MB, and it is taking ages. The time exploded

What is the difference between a session and a transaction in JPA 2.0?

我怕爱的太早我们不能终老 提交于 2019-12-18 10:14:04
问题 I just begin my JPA 2.0 studies, and I have this piece of code: em = SessionFactory.startSession(); tx = em.getTransaction(); My problem is: I'm not sure if I completly understand the difference between the use of a session and the use of a transaction. In a few lines, can anyone please tell me the biggest differences between them ? Thanks ! 回答1: You go to the bank to deposit 2 checks, and withdraw a small sum. So you stand in line until a teller opens. You make your first deposit. Then your

Java Persistence / JPA: @Column vs @Basic

拜拜、爱过 提交于 2019-12-18 09:59:29
问题 What is the difference between @Column and @Basic annotations in JPA? Can they be used together? Should they be used together? Or does one of them suffice? 回答1: @Basic signifies that an attribute is to be persisted and a standard mapping is to be used. It has parameters which allow you to specify whether the attribute is to be lazily loaded and whether it's nullable. @Column allows you to specify the name of the column in the database to which the attribute is to be persisted. If you specify

JPA query.getResultList()?

回眸只為那壹抹淺笑 提交于 2019-12-18 09:36:48
问题 I use JPA 1.0: Query query; query = em.createNamedQuery("getThresholdParameters"); query.setParameter(1, Integer.parseInt(circleId)); List<Object[]> resultList = new ArrayList(); resultList = query.getResultList(); Here I get result as List<Object[]> , thus I have to type convert all the parameters of the row to their respective types which is cumbersome. In JPA 2.0 there is TypedQuery which return an entity object of type one specifies. But as I am using JPA 1 I can't use it. How to get

How to handle several DB schemas with Hibernate?

天大地大妈咪最大 提交于 2019-12-18 05:22:38
问题 In one of my projects, I have an application that manages several clients (or customer if you prefer). For each of them, I have a dedicated schema on a database. However, the application handles only one client at a time, i.e. the user must switch from one client to another in the application (at runtime, no restart of the application) in order to access the data from this new client. How would you manage the connections, as well as the persistence layer, for this kind of project? I want to

How to write a WCF service with in-memory persistent storage?

爷,独闯天下 提交于 2019-12-18 03:11:15
问题 I wrote a WCF service, but the data stored in the Service implementation doesn't persists between calls, not even if stored in a static variable. What can I do? The service implementation is as follows: public class Storage : IStorage { protected static object[] _data; #region IStorage Members public void Insert(object[] data) { lock (_data) { _data = _data.Concat(data).ToArray(); } } public object[] SelectAll() { lock (_data) { return (object[])_data.Clone(); } } #endregion } The service

How to write a WCF service with in-memory persistent storage?

…衆ロ難τιáo~ 提交于 2019-12-18 03:11:06
问题 I wrote a WCF service, but the data stored in the Service implementation doesn't persists between calls, not even if stored in a static variable. What can I do? The service implementation is as follows: public class Storage : IStorage { protected static object[] _data; #region IStorage Members public void Insert(object[] data) { lock (_data) { _data = _data.Concat(data).ToArray(); } } public object[] SelectAll() { lock (_data) { return (object[])_data.Clone(); } } #endregion } The service

Storing game preferences and saved games in a secure format

落爺英雄遲暮 提交于 2019-12-18 01:20:23
问题 This is from Apple docs: When you design a game that reports scores to Game Center, you should also consider the security needs of your game. You want scores reported to Game Center to be an accurate accounting of how players are doing. Here are two suggestions: Store your game’s preferences and saved games in a secure format, rather than in clear text. If your game’s data is stored in clear text, a player can download the saved game data using iTunes, modify it, and resync it back to the