persistence

Best practice to join nhibernate and ASP.NET membership/role/profile services

Hi! I've got a generic ASP.NET (MVC) application, that uses NHibernate as the model persistence layer, and ASP.NET Membership/role/profile services as the user management layer. The question is what can be considered as the best practice to create linkings between the domain data and the users. (For example is I want to create a forum ...

JPA/Hibernate Query Returns Stale Results

I am using an EXTENDED Persistent Context because it will allow me to Lazily Load a one-many relationship on an object and it also won't require a SELECT before I "merge" an object with the persistent context. I have an DummyObject with: A "Last Updated" Date Field A One-Many Relationship This Object is being updated every 5 seconds...

Why does EclipseLink think my database schema doesn't exist?

I'm working on a web project using EJB 3.0, and whenever EclipseLink tries to interact with the database, it says that the schema I'm using doesn't exist (which it does). I get a massive, unhelpful stack trace from GlassFish 2.1, which begins with: EclipseLink, version: Eclipse Persistence Services - 1.1.0.r3639-SNAPSHOT file:/C:/Docu...

pandora website user profile system

Hi guys, does anyone know how Pandora saves user profiles/accounts after a user registers? How does it remember the user - even after the user has cleared cookies and cache. I also found today that if you register with one browser and visit Pandora.com with another browser you are recognized as the registered user. Awesome functiona...

Best practice to persist config/user info in .NET app

I have a low quantity of data to persist in my .NET app. For example, the file that has been opened last time when the user was around. What is the best practice to persist and retrieve information like that? A code sample would be appreciated. ...

Weird problem with session_set_save_handler() in PHP

I'm trying to write a custom session persister in PHP. But for some reason only my session read functon is getting called, not my session write function. Thus the session isn't persisted. If I switch back to the default session handler (file), everything works. If I add session_write_close() at the end of the test script - everything wor...

Persisting/retrieving settings at runtime using .NET compact framework

I want to save/restore my settings of my Windows Mobile application in runtime. The amount of data is insignificant, using database is an overkill. What would be the best practice for a task like that? I thought of something similar as Settings : ApplicationSettingsBase class in .NET full framework, but it is not supported in the compac...

How to properly implement a custom session persister in PHP + MySQL?

I'm trying to implement a custom session persister in PHP + MySQL. Most of the stuff is trivial - create your DB table, make your read/write functions, call session_set_save_hander(), etc. There are even several tutorials out there that offer sample implementations for you. But somehow all these tutorials have conveniently overlooked one...

How to pickle a CookieJar?

I have an object with a CookieJar that I want to pickle. However as you all probably know, pickle chokes on objects that contain lock objects. And for some horrible reason, a CookieJar has a lock object. from cPickle import dumps from cookielib import CookieJar class Person(object): def __init__(self, name): self.name = n...

How to keep Hibernate mapping use under control as requirements grow

I've worked on a number of Java web apps where persistence is via Hibernate, and we start off with some central class (e.g. an insurance application) without any time being spent considering how to break things up into manageable chunks. Over time as features are added we add more mappings (rates, clients, addresses, etc.) and then amoun...

domain driven design with nhibernate and sql server

I have a reference application that I use to work through DDD issues, and my current focus is on persistence. An alternate title for this post could have been DDD / TDD persistence tools and methods, but that is a (very) broad topic and I do have a specific question on SQL Server. I'm going to outline my current tool set in this paragra...

Netbeans / persistence API error

I am following this tutorial, I'm using netbeans 6.5.1 http://www.netbeans.org/kb/docs/java/gui-db-custom.html When I get to the part where I create the "new entity class from database", which is in the "Customizing the Master/Detail View" section of the tutoiral. I can't ever compile because I get this error in the task list (and I ge...

Is there a way to change the JPA fetch type on a method?

Is there a way to change the JPA fetch type on a single method without editing the entity object? I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my web application, the other needs eager fetching, as I need it to be threadsafe. Here is ...

Create a document library with external persistence

I would like to create a custom document library where I use the standard UI but implement a different persistence layer. Basically fetch and display documents from a different source system. This way I can use my existing object model but leverage the great office integration within SharePoint. I found a decent article here but they ar...

Easiest way to persist a data structure to a file in python?

Let's say I have something like this: d = { "abc" : [1, 2, 3], "qwerty" : [4,5,6] } What's the easiest way to progammatically get that into a file that I can load from python later? Can I somehow save it as python source (from within a python script, not manually!), then import it later? Or should I use JSON or something? ...

How to use non-key composite elements in EJB3?

Using EJB3/JBoss, how can I use a composite element from a table, e.g. @Entity public class X { @Id private int id; private Coordinate coordinate; } where Coordinate is a defined as (setters/getters left out for readability): public class Coordinate { int x; int y; } And everything should be mapped to Table X which...

How to store information in a Excel WoorkBook

I'm programing an Excel Addin with VS2008 and VSTO(C#) over Office 2007. This addin needs to store information embeded or inside the Wookbook to recover some status when the user opens again the Wookbook with this kind of information. Before save the Wookbook, the Addin serialize in XML all the information, and after open a WoorkBook th...

How do you robustly implement a REST service that retrieves DB records then purges them before returning ?

Scenario Imagine a REST service that returns a list of things (e.g. notifications) Usage A client will continually poll the REST service. The REST service retrieves records from the database. If records are available, they are converted into JSON and returned to the client. And at the same time, the retrieved records are purged from the...

Persisting User Specific Settings in ASP.NET Server-Side

I'm working on a .NET 3.5 Web Application and I was wondering what would be good way to persist user specific settings (i.e. user preferences) server-side? Here are the conditions: It needs to be able to store/retrieve settings based on a User ID I don't want to use SQL Server or any such DB engine I don't want to store it in cookies ...

Hibernate and JPA - Error Mapping Embedded class exposed through an interface

We have a set of interfaces, used as an API, and referenced from other modules. A set of concrete implementations of those interfaces, private to the "main" app module. These classes carry a number of annotations (JPA as well as XStream for XML serialization). I've run into a problem. We have a user class which had a number of fields w...