persistence

How can I set additional properties when an object is persisted from a database using NHibernate?

I'm creating an application that creates a Catalog of files. The data of the catalog will be stored in a database through NHibernate, but the actual files are just stored on a file system. I've abstracted the interface to the file system into an interface called IFileSystemAdaptor. When an object is persisted from the database I need ...

Persistence unnecessary in iOS 4.0?

I noticed that when the home button is pressed on the iPhone simulator to exit an app and then the app is re-entered it starts off right where it left off. Does this mean that programming persistence is no longer necessary? What if the user presses the power button on their ipod touch? ...

Python persistent socket connection

Hello, I'm new to python :) I would like to create persistent socket. I tried to do this using file descriptors. What I tried is: Open a socket socket connection s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) Get it's file descriptor number fd = s.fileno() Open the file descriptor as I/O os.open(fd) But I get OSError: [Errno ...

Array writeToFile

Let's say I create an object like this: Person: NSString *name; NSString *phone; NSString *address I create several of these objects. Then I create an NSMutableArray called people and store them in there. Can I save this array to disk with Array writeToFile? Does it need to be converted to NSData? ...

Saving a trie to disk

Hello. This sounds like a simple question, but I don't know how to search for its answer. I have a trie implementation in C# that will store about 80K words from a dictionary file. It takes quite a while to load all these words (more than 5 mins). I was wondering, what is the best way to "persist" those data so I don't have to reload al...

Silverlight : Persisting application on client side

Is it possible to cache the Silverlight application .xap file so that it is not downloaded always? ...

Inappropriate use of Builder pattern?

For a design patterns class, the instructor asked my team to develop an application that supports drawing and persisting glyphs, very similar to the WYSIWYG editor from GoF. My team decided to use a Layered architecture, with descending layers: Presentation, Controller, Logic, Persistence. The Logic maintains a collection of glyph repr...

Managing entities in NHibernate 1st level cache

What's the proper way to manage persisted entities in the 1st level cache during thread/session lifetime? Actually, there is only one or two persisted instances per thread (session) that should be present at all times, for referencing them from other (transient) entities before saving. Since I need to clear the session cache every once ...

How to test that objects get updated using a fake repository

Say I have the following business logic: foreach (var item in repository.GetAll()) { if (SomeConditition) { item.Status = Status.Completed; repository.Update(item); } } Now I write the following unit test: public void Test() { var repository = new FakeReposit...

@Id for oracle.rowid

Howto declare @Entity class for oracle table w/o PK? I has received the error message: Column "rowid" cannot be resolved on table "LOG" when doing mapping like this: @Entity public class Log implements Serializable { ... @Id private ROWID rowid; ... } ...

Is it possible in grails to disable persistence of a domain class?

To get around this I have to move such classes to src/groovy. It would be nice to have all of my domain model classes in the domains directory rather than split them up. Update 1: This is a popular (look for GRAILS-2515) requested feature on the Grails Jira page. If anyone is interested in this feature you can vote and track it here. U...

Many-to-one unidirectional GAE JDO relationship amongst Entities

I have two classes, Truck and Tweeter, where every Truck must have a Tweeter and every Tweeter can have any number of Trucks associated with it. All I want is to be able to store a reference of the associated Tweeter in all my Truck objects so I can access it without having to explicitly look it up. Given a Tweeter, I don't need to kno...

Using HSQL in-memory database as JPA datasource

I have an in-memory data source: java.sql.Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:testdb", "sa", ""); emf = Persistence.createEntityManagerFactory("manager"); But now I'm stuck. I want to use it as a JPA data source in a J2SE application. I've scoured the entire web but all info is related to J2EE. <pe...

Internal HSQL database complains about privileges

I'm setting up a standalone Java service with an in-process, in-memory HSQL database. Persistence.xml <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" ...

java.lang.IllegalStateException, "Primary key for object of type Parent is null" except I can print it and its NOT null

I cant imagine any more methods to solve my problem. Here's a thread I made yesterday that describes the parent and child class in detail: http://stackoverflow.com/questions/3800450/many-to-one-unidirectional-gae-jdo-relationship-amongst-entities I'm trying to add a Truck and persist it, but the persistence manager insists that the p...

Persistence entities as data transfer objects

I have some persistence capable Java objects with all the @annotations in my web application. All these objects reside in a data layer. Is it a best practice to use these persistence objects as data transfer objects? For example, if I want to pass back the data fetched from data store, should I directly return those persistence objects...

How to persist a collection of interface's Collection<Interface> in JPA ?

Hi, I have an the following scenario: // several classes that implement different interfaces class A implements X,Y {} class B implements Y,Z {} class C implements X,Z {} // other classes that contain collections of one of the interfaces(different objects) class G { Collection<X> mayContainAC; } class H { Collection<Y> mayContainA...

DAO and Manger pattern clarification

Hi! I'm new persistence and the DAO pattern. After seeing some code snippets, I wonder what the use of manager classes is (they seem to duplicate the functionality of DAO's)? I've tried searching for some tutorials but couldn't find any. Could you, please, give me some links/hints? ...

Is there a library that persists jung graphs from a datastore/database

I am looking for a way to persist jung graphs in a database or datastore. Is there a functionality in jung that I could use for this purpose? Maybe there is a library I could use? ...

AIR 2 - Data Persistence?

what is the best way to include data persistence in an AIR 2 application? is it creating your own read/write file with flash.filesystem, or is there a new way with AIR 2? ...