persistence

Should I pass in or encapsulate a connection in a DAO?

Is it better to encapsulate the connection inside a DAO, ie have the DAO create or retrieve the connection and then close, or is better to pass the connection into the DAO and handle the details in code external to the DAO? Follow-up: How do you mange closing connections if you encapsulate the connection inside the DAO? ...

iPhone-like Keychain in Android?

I'm looking for something like the keychain on the iPhone, but for Android development. Something that gives me the possibility to save small key-value pairs, that are persistent and unchanged even if the user reinstalls the application. Is there something like that? Can I use the standard preferences that way? I would like to achieve...

Please explain "How Fanboys See .NET Data Access Strategies"

This chart has been linked a number of times on blogs that I follow and I feel like a rube not getting it. So, going out on a limb here and asking this community. Please explain this grid from the blog post here. ...

ASP.NET MVC Session usage

Currently I am using ViewData or TempData for object persistance in my ASP.NET MVC application. However in a few cases where I am storing objects into ViewData through my base controller class, I am hitting the database on every request (when ViewData["whatever"] == null). It would be good to persist these into something with a longer ...

Web service under JBoss using Hibernate: first steps

What's the difference between building a stand-alone application based on Hibernate and a web service (JBoss) based on Hibernate? I'm refering at the creation of the SessionFactory, Configuration and Sessions. What special concerns should I take care when building a web service with Hibernate persistence? I would really appreciate a bas...

In CakePHP 1.3 is there any advantage of using $this->Controller->Session over $this->Session in a component?

I'm using a modified version of Felix Geisendörfer's SimpleAuth/SimpleAcl components that I've combined into a single Component, Simple_Authable. I changed his startup() function to initialize() to not clutter the beforeFilter function in my app_controller. One of the things that this component does is check who the active user is and ...

Problem updating collection using JPA

I have an entity class Foo foo that contains Collection<Bar> bars. I've tried a variety of ways, but I'm unable to successfully update my collection. One attempt: foo = em.find(key); foo.getBars().clear(); foo.setBars(bars); em.flush; \\ commit, etc. This appends the new collection to the old one. Another attempt: foo = em.find...

stoping doGet/dopost in java servlets ?

Hello everyone, I've been playing with Java Servlets and Ajax a bit, and I've got a situation on which I would really appreciate advice. Let's say I have HTML page with a start and stop buttons, and as a result of clicking start button, overridden doGet (or doPost) method on a servlet is invoked which computes something that takes a l...

How to persist and load an object which conforms to NSCoding protocol?

I have made an class which conforms to the NSCoding protocol and does all the encode and decode stuff. For my app, I simply want to persist an object from that class to the device and the next time when the app launches, I want to load that object back into memory. Basically it's just an class which holds some user input information. F...

Strategy to keep track of stored files in the documents directory?

In my app, the user can save his input to disk. This is done with NSKeyedArchiver. Currently I simply name my files with a timestamp. But of course, the user may want to load one of them back in to keep on editing them. What would be the most reliable / safe strategy to keep track of those files? I need to present the user a list of tho...

Persistence provider for Java that supports final fields

I'm very new to Java but I've been developing a habit to use final wherever possible declaring immutability which i think is a good thing. (Consider f#) I've read that JPA does not support final fields. Hibernate, TopLink? I'm not sure about these but i prefer JPA for now. Is that even possible theoretically - let's say through reflect...

What is a simple way to get ACID transactions with persistence on the local file system (in Java)?

I'm working on a small (java) project where a website needs to maintain a (preferably comma-separated) list of registered e-mail addresses, nothing else, and be able to check if an address is in the list. I have no control over the hosting or the server's lack of database support. Prevayler seemed a good solution, but the website is a g...

Problem with bidirection ManyToOne

I have two entities: Message and GeneratedMemberMessage. There are more fields than I'll show in code here, but these should provide enough for context to my question. I'm trying to do a simple bidirectional OneToMany relationship and from all that I've read, this is how it's to be done. You'll notice that I'm using composite keys. ...

Which data will be deleted, if a user uninstalls an android application

If a user uninstalls an app from his phone, which data is explicitly deleted? I know that preferences are deleted. What about files on the sd card and about databases created by this app? If the data on the sd card is not deleted how can I avoid cluttering the users phone if I write larger amounts of data, like images on the sd card? ...

Java framework "suggestion" for persisting the results from an Oracle 9i stored procedure using Apache Tomcat

I am developing a Java servlet which calls an Oracle stored procedure. The stored procedure is likely to "grow" over time, and I have concerns the amount of time taken to "display the results on a web page". While I am at the implementation stage, I would like some suggestions of a Persistence framework which will work on Apache Tomcat...

Blackberry persistance: ObjectGroup createGroup vs. createGroupIgnoreTooBig

What is the difference between the createGroup and createGroupIgnoreTooBig? I understand that createGroup will throw the too big exception when the object exceeds 64k, and createGroupIgnoreTooBig will not. But does it mean that createGroupIgnoreTooBig allows me to create objects larger than 64k, or will it only partially group it? ...

Passing empty list as parameter to JPA query throws error

If I pass an empty list into a JPA query, I get an error. For example: List<Municipality> municipalities = myDao.findAll(); // returns empty list em.createQuery("SELECT p FROM Profile p JOIN p.municipality m WHERE m IN (:municipalities)") .setParameter("municipalities", municipalities) .getResultList(); Because the list is em...

How might you make a Rails test fixture persistent between tests?

I have a good half-dozen fixtures in my Rails test suite - some quite large - that represent static look-up tables in the database. Since their values theoretically don't change, I'd like to save the time of wiping and reloading the tables between each test. Is there a trick/plug-in/gem/hack to demarcate these fixtures as only needing ...

iphone bookmarklet cookie persistence

I have an iphone (jqtouch based) web app that uses cookies for authentication. The use flow is as follows : user goes to the mobile landing page and is instructed to save the page as a bookmarklet on their home page. they launch the bookmarklet to go to a login page to login and get a cookie. the cookie works and they can navigate thr...

Storing simulation results in a persistent manner for Python?

Background: I'm running multiple simuations on a set of data. For each session, I'm allocating projects to students. The difference between each session is that I'm randomising the order of the students such that all the students get a shot at being assigned a project they want. I was writing out some of the allocations in a spreadsheet ...