persistence

Selecting between shelve and sqlite for really large dictionary (Python)

冷暖自知 提交于 2019-12-03 16:56:14
问题 I have a large Python dictionary of vectors (150k vectors, 10k dimensions each) of float numbers that can't be loaded into memory, so I have to use one of the two methods for storing this on disk and retrieving specific vectors when appropriate. The vectors will be created and stored once, but might be read many (thousands of) times -- so it is really important to have efficient reading. After some tests with shelve module, I tend to believe that sqlite will be a better option for this kind

Hibernate: How configure EntityManager in Hibernate?

故事扮演 提交于 2019-12-03 14:19:42
问题 I create a hibernate project with 'hibernate tools'provide by JBoss to Eclipse. Generated the Entities (POJO's) and then the DAO's. This way for example: @Entity @Table(name = "area", catalog = "project_schema", uniqueConstraints = @UniqueConstraint(columnNames = "area")) public class Area implements java.io.Serializable { private Integer id; private String area; public Area() { } public Area(String area) { this.area = area; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id",

Persisting entities using a REST API

一曲冷凌霜 提交于 2019-12-03 14:18:32
For a project in Symfony2 I need to be able to persist / retrieve entities using an external RESTful API, instead of the database. Since Doctrine maps the entity to a row of a database table, I thought it should be easy to create a mapping from the entity to an external API as well. However, this is new for me and I can't seem to find any descriptions / tutorials about this. (perhaps I'm missing the right words for my Google-fu) I was hoping there is a solution similar to Doctrine. I'd rather not use something based on the ActiveRecord pattern, because I want the persistance logic to be

Update multiple rows using hibernate Criteria

拈花ヽ惹草 提交于 2019-12-03 13:56:06
I am trying to run an update query which would look like this in sql: update studentMaster set sess_status = 'G' where ACADEM_YEAR = COURSE_YEAR; I am trying to re-create the query using Criteria like this: public void updateSessionStatus() { Session sess = factory.openSession(); Transaction tx = null; try { tx = sess.beginTransaction(); Criteria crit = sess.createCriteria(CollegeStudentsMaster.class); crit.add(Restrictions.eqProperty("academicYear", "courseYears")); CollegeStudentsMaster e = (CollegeStudentsMaster) crit.uniqueResult(); e.setSessionStatus("G"); sess.saveOrUpdate(e); tx.commit(

How do you manage versions in Workflow Foundation?

匆匆过客 提交于 2019-12-03 13:55:40
问题 How do you manage versions of work flows in WF when you have long running work flows and you might have two or three versions in the persistence store at the same time and have to be able to access them all? 回答1: I did a series of 4 blog post covering most of the stuff you need to be aware of when versioning long running workflows. One thing I tend to avoid is using the HandleExternalEventActivity as this greatly complicates things. For that matter I tend to stick to simple types and xml

How would one make Python objects persistent in a web-app?

二次信任 提交于 2019-12-03 13:34:04
问题 I'm writing a reasonably complex web application. The Python backend runs an algorithm whose state depends on data stored in several interrelated database tables which does not change often, plus user specific data which does change often. The algorithm's per-user state undergoes many small changes as a user works with the application. This algorithm is used often during each user's work to make certain important decisions. For performance reasons, re-initializing the state on every request

Is closing and reopening Realm instances bad for performance?

你离开我真会死。 提交于 2019-12-03 12:53:18
问题 When using SQLite I usually have a single SQLiteOpenHelper instance per application and I never ever close it, since its database is used continuously by many other classes and closing/reopening it would be slower and more complicated. Now I'm toying with Realm and I'm planning to access Realm instances only from Data Access Objects. Every call will be made from a worker thread. I've been reading the examples and they usually call getInstance/close per Activity or background task. Since Realm

What's the best way to persist data in a Java Desktop Application?

二次信任 提交于 2019-12-03 12:03:05
I have a large tree of Java Objects in my Desktop Application and am trying to decide on the best way of persisting them as a file to the file system. Some thoughts I've had were: Roll my own serializer using DataOutputStream : This would give me the greatest control of what was in the file, but at the cost of micromanaging it. Straight old Serialization using ObjectOutputStream and its various related classes : I'm not sold on it though since I find the data brittle. Changing any object's structure breaks the serialized instances of it. So I'm locked in to what seems to be a horrible

Persistent connection with client

落花浮王杯 提交于 2019-12-03 12:02:33
问题 Is there a general way to implement part of an application with JavaScript and supplying a persistent connection to a server? I need the server to be able to push data to the client, regardless of the client being behind a firewall. Thanks in advance 回答1: See Comet - it's like ajax, but it holds a connection open so the server can push information to the client. Note that compliant browsers will only hold 2 connections (note: most modern browsers no longer comply) to a particular domain (by

Which is best data access options available for Play framework with Scala and PostgreSQL?

戏子无情 提交于 2019-12-03 11:37:41
问题 We have earlier experiences and lots of reusable code/components mostly done using Spring MVC, Hibernate, PostgreSQL database. But recently we are planning to start a new project. We decided to use Play framework with Scala. We are new in Play framework with Scala. Thus we couldn't decided what ORM (Object-relational mapping) framework to use. Because of many reusable code, we wish to select Hibernate. We found scary words regarding Hibernate as "JPA using Hibernate in Scala with play it is