persistence

Using JSON serialization as a persistence mechanism instead of RDB

I'm thinking about throwing away my DB in my next project to simplify development/evolution. One way to do it is not to leave the Objects realm at all and persist my objects by some kind of serialization. It would be nice to be able to edit the initial objecs state when the app is down, so format like Json would be great. The problem i...

Hibernate configuration

I'm trying to get started with Hibernate, and when executing my program I get an error during initialization. The exception is thrown by this class, copied from here: package net.always_data.bastien_leonard; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static fi...

handling history/change tracking in the DB and consequences on the BL

hi in the current application im working on the client requested that we will save history of every action that happended in the system and provide the ability to backtrack to the previous state of the information. for example: lets say that my app need to handle a storage-room and each user can add/update/delete/read (all CRUD) the inv...

JPA merge does not appear to work

Hi, I'm running the following code to update the database according to the data I read from CSV file. I've tried to debug, and check the console and it's running through the whole 800 records. I don't get any error, but only the first record is inserted. If I'm using persist instead of merge, I got "Cannot persist detached object" error....

Can javascript access a filesystem?

I was pretty sure the answer was NO, and hence google gears, adobe AIR, etc. If I was right, then how does http://tiddlywiki.com work? It is persistent and written in javascript. It is also just a single HTML file that has no external (serverside) dependencies. WTF? Where/how does it store its state? ...

Magma, GOODS, GLORP, or something else?

So I've been using Smalltalk for about 6 months now (Squeak and Pharo), mostly doing data analytics, and I'm about to start my first Seaside app. So my question to all you Smalltalkers out there is, what is your favorite persistence solution? I've been looking at Magma, GOODS, and GLORP. I'm a long-time python hacker, so I get ORM, but i...

Spring DaoSupport and @PersistanceContext EntityManager?

One of the most difficult things about understand Spring is that Spring supports multiple approaches to the same problem. So in my application I using injected EntityManager using the @PersistanceContext annotation, for example: @Repository public class JpaDao extends JpaDaoSupport implements Dao { @PersistenceContext(unitName = "...

Changing the type of an entity preserving its ID

Hi, everybody. I am using hibernate as a persistence layer. There are 2 entities that live in the same table extending one superclass with single table inheritance strategy. @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public abstract class A { @Id @GeneratedValue protected Long id; // some common fiel...

How can you replicate Hibernate's saveOrUpdate in JPA?

In JPA, is there any way you can replicate Hibernate's saveOrUpdate behavior, saveOrUpdate public void saveOrUpdate(Object object) throws HibernateException Either save(Object) or update(Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-val...

How to model an n-to-n relationship in Objective-C?

I am trying to model an n-to-n relationship in Objective-C. Suppose I have two entities: Movie and Theater. A Movie has an array of Theaters and a Theater has an array of Movies. How do I do this in Objective-C to 1) get the relationship correct and 2) make sure memory is managed correctly. ...

JavaScript variable scoping - persisting state?

Hi, I have the following setup, and I need to know how to persist state. 1.) An external web page uses ajax to load and display a .jsp file, which contains javascript. 2.) Once this rendering is complete, javascript in the .jsp file must be called to perform an action based on the results that occurred during rendering. Specifically, th...

Variable persistence in PHP

i have a php page, on that page i have text boxes and a submit button, this button runs php in a section: if(isset($_POST['Add'])){code} This works fine here and in that section $name,$base,$location etc are calculated and used. but that section of code generates another submit button that drives another section of code. it is in ...

NHibernate set properties automatically on save

I'm using DDD and NHibernate to persist my domain object. In my database every table that is related to an entity has four extra columns (CreatedBy, UpdatedBy, CreatedDate, UpdatedDate) used for audit tracking. I am using the repository pattern that only allows aggregate roots to be saved. When NHibernate tries to save the entities on th...

persistence of checkbox values

I have a page with several checkboxes. I check a few of them and go to the next page, when I come back on this page, these checkboxes need to remain checked as they were before navigating to another page. Need to do it with Javascript. Any clue?? ...

What best practices do you recommend for safeguarding user data while writing to a file?

Let's say you have a program, like a text editor or a word processor, that writes to user-created files. What steps should be taken to guarantee the minimum risk of data loss or corruption in the face of crashes, out-of-space errors, sudden power loss, race conditions, etc? ...

No Persistence provider for EntityManager named ...

I have my persistence.xml with the same name, using toplink, under META-INF directory. Then I have my code calling it with... EntityManagerFactory emfdb = Persistence.createEntityManagerFactory("agisdb"); Yet, I got the following error message 2009-07-21 09:22:41,018 [main] ERROR - No Persistence provider for EntityManager named agi...

One-To-Many child has already been persisted without parent

I'm using the Google App Engine in combination with the Google Web Toolkit to write a bug tracker (to see what the technologies are capable of). Modelled after Google Code's issue tracker, I decided that an issue can have 0 or more labels, that can be defined beforehand (let's say in the settings). The label class (CustomLabel): @Pers...

Is a Persistent Store a requirement for Core Data on the iPhone?

Hey guys, I'm looking to use Core Data within my iPhone app. The app doesn't really need to store the data that is used, but it needs to be managed and queryable. Can Core Data be used for datasets that exist purely in memory and are not persisted to the disk? ...

Configurable persistence in Java EE5+

There are 2 ways of using a persistence unit, code or annotation. CODE [..]EntityManagerFactory emf; emf = Persistence.createEntityManagerFactory("SOMEPU");[..] or ANNOTATION [..] @PersistenceContext(name = "persistence/LogicalName", unitName = "SOMEPU") [..] Question: If you want to change the persistence unit (or point to d...

How can I access the data in many large CSV files quickly from Perl?

I have a number of scripts that currently read in a lot of data from some .CSV files. For efficiency, I use the Text::CSV_XS module to read them in and then create a hash using one of the columns as an index. However, I have a lot of files and they are quite large. And each of the scripts needs to read in the data all over again. The q...