persistence

How do I save a new object using NHibernate when it already has an ID?

I'm using GUIDs for the identifier on my objects it is assigned when the entity is instantiated. I want to save them using NHibernate and have NHibernate determine whether it's a new object or not. If it's a new object, it should INSERT it, otherwise it should UPDATE it. How would I do this? ...

Java Hibernate service class

Dear All! I have a painful problem regarding Java Hibernate. I have my own POJO classes in my modell, and I would like to submit query from an instance of that class, to a table of my relational DB. The problem is, that I want to submit several different queries to different tables. For example: I have a Bus class, representing buses. ...

Testing Data Model in project that uses NHibernate for persistence

I'm still new with NHibernate, so correct me if I'm wrong on any of this. When you are using NHibernate to build collections of objects from database records, NH takes care of instantiating your collections and populating them. How do you instantiate your ISet collections when you are writing tests that don't actually use NH? ...

Wipe all data stored with CoreData when the model has changed

I have an app that fetches data from the internet and uses CoreData to store them in the device, for a smoother experience. Because I use Core Data, every time my schema changes, the app crashes when I try to run it with the previous data stored on the device. What is the fastest way to detect this change and wipe all the data from the ...

what patterns allow for object persistance using sql and nosql databases?

With the rise of the nosql movement we see different options for storing objects. Are there object persistence patterns that can handle both sql and nosql backends and allow to easily switch between the two? ...

iPhone UIImage - Data Persistance

Hi All, Simple question regarding data persistance between application sessions. My application allows the user to select an image from the Library using a UIImagePickerController. The selected photo is then used as the background to the application. As the UIImagePickerController delegate method actually returns an image as opposed t...

Java JPA Inner JOIN with WHERE statement

Hi folks, I want to annotate following structure: I have this query: SELECT A.*, BES.*, BES_2.* INNER JOIN BES ON A.a = BES.a AND A.b = BES.b INNER JOIN BES AS BES_2 ON A.a = BES_2.a AND A.b = BES_2.b WHERE (BES.c = N'foo') AND (BES_2.c = N'bar') I have the entities Job (representing A) and JobEndPoint (representing BES). The Job...

Preventing NaN from being persisted by Hibernate

I am using Hibernate as my JPA provider with it connecting to a Progress database. When a NaN value is persisted it is causing lots of problems - it prevents the row from being read in certain circumstances. Is there a way to hook in to the standard double type persistence to convert NaN (and probably + and - infinity) to a different val...

GWT + Object Persistence + Maintaining Data In Memory

Hi, I am currently carrying out research for the design and implementation of a web-based RSS aggregation system, with the aim being the use and evaluation of recommendation algorithms. This system will require a relatively interactive web-based UI (hence my interest in using GWT) and some form of data persistence to store RSS feed det...

Where is the data stored when we implement Blackberry persistent apis to store data?

Where does the data get stored when we use a Blackberry Persistent store to save data in our applications? Is it the removable sd card or device memory? ...

How to write a WCF service with in-memory persistent storage?

I wrote a WCF service, but the data stored in the Service implementation doesn't persists between calls, not even if stored in a static variable. What can I do? The service implementation is as follows: public class Storage : IStorage { protected static object[] _data; #region IStorage Members public void Insert(object[] ...

When should I use the JDBC Persistence Adapter in ActiveMQ?

Hi, reading the ActiveMQ documentation (we are using the 5.3 release) I find a section about the possibility of using a JDBC persistence adapter with ActiveMQ. What are the bennefits? Does it provide any gain in performance or reliability? When should I use it? ...

How to configure JPA to use JNDI?

I have a working persistence definition that works on java level tests. Now I want to incorporate that into a web application which defines the database connection as JNDI in the context.xml. What do I need to change to make it work with the JNDI instead of the persistence.xml or at least get the infor from there? ...

Jpa query pulling from cache instead of database?

I am hitting an issue with my Hibernate backed Jpa queries returning data that is not up to date. I assume it is an issue with pulling data from the cache instead of the database itself. For example, I will change and persist an object on one page and then go back to the previous page, which lists rows of the database, and it will show ...

Do gae datanucleus annotations modify our java code?

I placed this question in Google groups for gae java (http://groups.google.com/group/google-appengine-java/browse%5Fthread/thread/85dc9f10d7e12a3), but sometimes it takes a week for someone to bother answering a question and I feel I need to know the answer much quicker. We are advised to have our persistent fields accessible only thro ...

How to configure & package a simple Java app to uss JPA

I'm trying to learn JPA and I want create a simple Java command line app that will use JPA to query and update a database table. I mapped out the the simple code needed to do this. But I don't know how to configure the directory structure, where to place the persistence.xml file, packaging and so on. This is just a quick and dirty lea...

Use Tomcat 6.0 as server for java web application cause javax.persistence annotations to be messed up

Normally, I use Glass Fish as my testing server for NetBeans. Recently, I tried to switch to Tomcat 6.0. As soon as I changed the server, compiler no longer understand javax.persistence.Entity. When I checked out the library structure of Tomcat 6.0, there was a file named annotation-api.jar, in which another javax.persistence package res...

Persistence on Java CI-Bayes object

Has anyone ever persisted a training set for CI-Bayes? I have sample code from this site: http://www.theserverside.com/news/thread.tss?thread%5Fid=49773 here is the code: FisherClassifier fc=new FisherClassifierImpl(); fc.train("The quick brown fox jumps over the lazy dog's tail","good"); fc.train("Make money fast!", "bad"); String c...

Validating a domain object for persistence

In the system I'm currently working on, I'm following SRP (I think!) by separating the validation of domain business rules vs persistence constraints. Let's employ the overused customer example. Say a customer must have a valid zip code, street address and name to satisfy the system's business rules. Let's further say that the customer...

What is a persistence engine (like ActiveRecord)? Advantages? Disadvantages?

Hey all, I've heard all this talk about Rail's persistence engine (ActiveRecord). I did a search on it and I couldn't really get a clear idea of what it did. It seemed like it was an Object mapping to a database but that's all I came up with. If so do they save the objects to the database to maintain persistence? What are the advantages...