persistence

Should persistent objects validate data upon set?

If one has a object which can persist itself across executions (whether to a DB using ORM, using something like Python's shelve module, etc), should validation of that object's attributes be placed within the class representing it, or outside? Or, rather; should the persistent object be dumb and expect whatever is setting it's values t...

How can I test wether persistence.xml has been found or not?

I have to test some things on a project which has been developed by others, but is new to me. They are using Hibernate as a JPA implementation. I got a virtual machine in which everything is set up, but when I want to start any Testclient (small console programs, no Unittesting). I always get the same error. Exception in thread "main"...

Python class for pickle- and copy-persistent object?

I'm trying to write a class for a read-only object which will not be really copied with the copy module, and when it will be pickled to be transferred between processes each process will maintain no more than one copy of it, no matter how many times it will be passed around as a "new" object. Is there already something like that? ...

How to open a core data database?

Is there any way in which I can view my core data database without having to load it programatically through the code?! ...

Alternatives of persisting data using C#?

I have a small application in C#, and so far I have implemented it using data persistence classes that are running SQL directly, I understand there are better alternatives as Hibernate.NET and possibly Spring.NET. There are some other I forget? pros and cons? thanks! ...

Detecting Changes in Entities within an Aggregate Root

I am looking to see what approaches people might have taken to detect changes in entities that are a part of their aggregates. I have something that works, but I am not crazy about it. Basically, my repository is responsible for determining if the state of an aggregate root has changed. Let's assume that I have an aggregate root calle...

Is this a ManyToMany JPA/Hibernate relationship or there is another way to map this ?

Hi, I'm getting started with JPA and created the following (simplified) tables; airport -------- id (pk) city code ... trip -------- id (pk) originAirport_id (fk) destinationAirport_id (fk) ... I'm trying to map this in JPA/Hibernate. In My trip object I created 2 airport objects: private Airport airportFrom; private Airport ai...

Explaining persistent data structures in simple terms

I'm working on a library for Python that implements some persistent data structures (mainly as a learning exercise). However, I'm beginning to learn that explaining persistent data structures to people unfamiliar with them can be difficult. Can someone help me think of an easy (or at least the least complicated) way to describe persist...

Best way to persist state with Tomcat/Scala?

What's the best way to persist user state with Tomcat/Scala? My first thought is to keep account information on the session at all times and redirect the user to a login page if there's no information on the session for the account. Is this a viable model, or is there a smarter way of persisting user information? I'm trying to replicate ...

iphone: Can I save user input to a plist that lives in the resources folder?

Hi, I have a plist in my Resources folder that I'm using to store conversion information. I'd like to give the user the ability to "turn off" certain units so that those units will never be used in conversions. I don't want to have to maintain two lists with the conversion information in it. I am able to save data back to that pli...

WinForms - which is easiest approach for persisting some data?

Hi, Just building my first WinForms application. Question - What's the easiest/best approach for saving some data between use of the application (e.g. list of URL with status & date/time in this case)? I don't see any need for a database. For example * Is just storing to text file easiest? * Or is storing to XML file just as ea...

Some kind of Data persistency

Hi to all, Basically what I need to know is this: I have to show a drop down list of countries to my users each country also has a code associated to it. I will have to work with both the country and the code What would be the best approach: -We (the dev.) are thinking about a table in our app database with this data, or XML file. -O...

Changing target table for Hibernate mapping

Is it possible to change the target table for a Hibernate mapping? My use case is that while I get the data from one table, in cases where the data cannot be processed it is stored in a error table for later analysis. Although it is possible to define entity-names in hibernate mappings, in my opinion it is not appropriate because it re...

.NET persistence framework that supports test data

We are currently using SubSonic as our persistence layer because it's light but also because it allows us to feed in test data so our DAL can be tested without hitting the database. I absolutely love that about SubSonic. However, because we are also running into other issues with SubSonic, I'm now looking for an alternative while our p...

Persisting complex test data

We are using builder pattern to generate test data. These domain objects have relations between them. Our functional tests require these objects to be persisted. Think about this model: If I want a plain instance of C I do aNew().c().build() If I want it to be persisted I do aNew().c().saveIn(session) If I want an instance of C wit...

Load balancing: DNS round robin in front of hardware load balancers. How to share stickiness?

Hi, DNS Round Robin (DRR) permits to do cheap load balancing (distribution is a better term). It has the pro of permitting infinite horizontal scaling. The con is that if one of the web servers goes down, some clients continue to use the broken IP for minutes (min TTL 300s) or more, even if the DNS implements fail-over. An Hardware Loa...

Persistence Pattern - Rule based Observer

I'm trying to add functionality to an app where a user can subscribe for changes made either: To another entity (by any user) By another user (to any other entity) A combination of the two (this last one's optional, but makes the problem more challenging) I'm wondering how best to persist these rules to the database. I'm naturally t...

When setting a session with PHP, how do you make it global to the entire site?

I am creating a session and I want a variable to be available for the entire site, so for example: Joe Soap lands on a page called red-widgets.php, - Joe's session variable is let's say 'red-widgets'. Joe then clicks on another page called blue-widgets.php. I would like the session variable to be still the original 'red-widgets'. How c...

Data Access Layer or having object with CRUD methods?

I used to have a Data Access Layer that take the object by parameter and handle with abstraction the type of persistence required. At my new job, the architect is thinking to implement CRUD operation (load..save..delete..update) into all model object. Those method would have an object by parameter that will handle the saving of the objec...

Need help with some Hibernate relational mappings

These are the tables I want to map using Hibernate: user (PK UserId) article (PK ArticleId, FK CreatorUserId) category (PK CategoryId, FK ParentCategoryId) I have been looking at the documentation for Hibernate, but I really cannot choose what type of mapping is the most suitable for my tables. Any help would be greatly appreciated! ...