persistence

Methods and recommendations for testing persistence of entities

Everyone loves unit testing. But testing persistence of entities is a bit different. You are testing a process occurring across multiple layers using different languages. Your tests have side effects (in the sense that rows are being added / modified etc). I would like to know how you do this. For example, do your tests create a whole n...

WF4: Persistance and DTC

Hi ! I'm building a workflow host that will manage WorkflowApplication instances. Instances will use SqlWorkflowInstanceStore. Tables and logic for SqlWorkflowInstanceStore are in the same database as my other tables and logic that I'm writing into with persistence participants. I'm not using AppFabric. My question is: do I need DTC...

DataSet changes not being persisted to database

I have a windows form with a number of data-bound fields relating to a client. Additionally, I have a DataGridView showing orders for the currently displayed client. This is achieved using the design-time Visual Studio controls (e.g. a project DataSet, BindingSources TableAdapters and a TableAdapterManager. When loading the form to edit...

How to use JPA EclipseLink to connect to the DB in a multi layer environment (REST + EJB + Core) ?

I am using Glassfish v3 server. Usually the DB connection with EJB3 + JPA (Eclipselink) is done through injection, with @PersistenceUnit or @Persistencecontext. However, there are 3 layers in my App : Core (contains business logic, entities, exception handling etc) an EJB on top of it, calling the right core objects and methods to do...

Hibernate Monitoring Solution

Hello, I would like to monitor hibernate action. I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last version of hibernate 3.5.*? if it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created...

In python, looking for an alternative to Shelve (too slow for large dictionaries).

I am storing a table using python, and I need persistance. Essentially I am storing the table as a dictionary string to numbers. And the whole is stored with shelve self.DB=shelve.open("%s%sMoleculeLibrary.shelve"%(directory,os.sep),writeback=True) I use writeback to true as I found the system tend to be unstable if I don't. So aft...

entityManager.persist(user) -> javax.persistence.EntityExistsException: User@b3089 is already persistent

// lookup existing user & set a currently null child entity (ContactInfo) user.setContactInfo(contactInfo); // update the user in the datastore with newly created child Entity entityManager.persist(user); Generates exception: javax.persistence.EntityExistsException: User@b3089 is already persistent Since the user alrea...

Best Persistence model for iPhone development

I'm finishing my second book on iPhone development (Beginning Iphone 3 Development - Mark/LaMarche) and, while this book covers the 4 main persistence mechanisms, I'm still not sure which one to use for my application. My data model is not very intricate, but I do need some relationship definition and functionality. So what are the sea...

JPA persist same entity twice

Hey guys, I just noticed that a part of code I worked on saves the same entity twice. I tried several tricks, like flush() and Transaction REQUIRES_NEW but nothing does it. But I can see while debugging that after calling persist(entity), I get an ID (IDENTITY) for that entity... but just a bit later in the code if I look at the variable...

Classic asp persist custom classes in session

Is it possible to persist a class in session that I define in VBScript in classic asp: <script runat=server language=vbscript> Class clsCourse Private Sub Class_Initialize ' Statements go here. End Sub End Class dim oCourse set oCourse=new clsCourse </script> How would I persist oCourse in session and recover it from session? I ...

How to best pickle/unpickle in class hierarchies if parent and child class instances are pickled

Assume I have a class A and a class B that is derived from A. I want to pickle/unpickle an instance of class B. Both A and B define the _getstate_/_setstate_ methods (Let's assume A and B are complex, which makes the use of _getstate_ and _setstate_ necessary). How should B call the _getstate_/_setstate_ methods of A? My current, but per...

Tips for Manually Managing Persistence Context

I am investigating using JPA for my Data Access code. I am trying to write the business layer and data access layer so it will work in a web application and a Java SE application. Therefore I cannot use container managed persistence context. Most of my seraches on using JPA show examples in a container managed enviroment. At the mome...

Distributed Key/Value Stores that can run on Windows, and have .Net clients?

As the title says, does anyone know of any Distributed Key/Value Stores that can run on Windows, and have .Net clients? Thank you Update: Sorry, forgot to add that it needs to be persisted. ...

JPA get values from the collections in entities

Hi, I'm new to JPA and now stuck with a problem! I have two tables Person and PersonAddress. In the Person entity, I have @OneToMany(mappedBy="personid") private Set<Personaddress> personaddressCollection; and public Set<Personaddress> getPersonaddressCollection() { return this.personaddressCollection; } public void setPerson...

JPA Glassfish Database Update Issue

Hi, I have an application deployed on Glassfish v3.0.1 which reads events from a table in my database. Once ready it marks them as processed. I am getting a strange error I can't explain when trying to call the method which does the update. @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void markEventAsPr...

Fluent Nhibernate: Mapping single entity with interface requirements

Good afternoon. Before I begin my explanation, I have had a look at other similar questions but the subtle differences (mainly in purpose of design) mean that the solutions provided in these answers to not apply to me. I am attempting to create a 'Base data access library' for use with future projects so that I do not have to spend my ...

JPA - getting distinct value from one column

I have an entity that has few fields. One of them is city name. Now I want to get list of all distinct cities from that table. How can I archive that. I tried using DISTINCT keyword, but it doesn't work. I'm using Hibernate as JPA provider but I would like to get it in pure JPA Query. ...

Problem persisting read/write collection at design-time in .Net Winforms.

I have a requirement to persist a collection at design-time: Public Class MyButton Inherits Button Private _MyCol As MyCol <Editor(GetType(MyColEditor), GetType(UITypeEditor))> _ Public Property MyCol() As MyCol Get Return _MyCol End Get Set(ByVal value As MyCol) _MyCol = ...

Dynamically Loading Controls and Persistence in ASP.NET

I am loading a series of controls in the Page_Load event. However, I have to recreate those controls each page load, which means storing their data elsewhere. This is cumbersome. protected void Page_Load(object sender, EventArgs e) { MyControl control = (MyControl)LoadControl(...); control.Initialize(GlobalClass.controlData); ...

WF4 Custom Persistence Examples

I am writing my own custom persistence instance store for WF4, based on the XmlWorkflowInstanceStore found in the .NET 4 WF and WCF samples. This sample is quite simplistic and the xml is produces is quite verbose. I have issues with how some of the objects are serialized. I have tried using Red Gate Reflector to understand the Sql impl...