persistence

Using PLists for Persistence on iPhone

五迷三道 提交于 2019-11-29 05:21:21
Simple question about property lists within an iphone app. I know you can read data in from a plist, but is there a way to write user-inputted data to a plist? If so, how? It's easy to find tutorials on reading information from plists, but I'm having trouble finding resources on writing to plists. This is how I write data items to a plist: [myPlistFile setInteger: myInt forKey: @"someKey"]; Of course, you can change setInteger with setBool, etc for different types. Hope this helps! -- Edit: If your .plist was a member of an important class or similar... Header of myClass: NSUserDefaults*

What are synchronizing strategies for Prevayler?

一世执手 提交于 2019-11-29 04:46:47
Prevayler guarantees that all the writes ( through its transactions) are synchronized. But what about reads? Is it right that dirty reads are possible if no explicit synchronizing is used (in user code)? Are they possible if a business object is read as: // get the 3rd account Accont account = (Bank)prevayler.prevalentSystem().getAccounts().get(2); ? If so what synchronizing strategies are good for a user code? (Consider a business object A contains a collection of business objects Bs), using a synchronized collection (of Bs inside of A), for example from java.util.concurrent package?

Does static variables in php persist across the requests?

余生长醉 提交于 2019-11-29 04:44:05
问题 Static variable gotcha in php I am from Java background and have switched to php for one project recently. I have found one unexpected behaviour in php. Value set to some static variable is not staying persistent across the requests. I am not sure if this is the expected bahaviour. Because in java , you can always persist very commonly used variables or say constants like dbname,hostname,username,password across the requests so that you don't have to read them always from local property files

Correct way to persist Quartz triggers in database

百般思念 提交于 2019-11-29 03:54:00
问题 I'm quite new to Quartz and now I need to schedule some jobs in Spring web application. I know about Spring + Quartz integration (I'm using Spring v 3.1.1) but I'm wondering if this is the right way to follow. In particular I need to persist my scheduled tasks in a DB so I can re-initialize them when application is restarted. Are there some utilities provided by Spring scheduling wrapper to do this? Can you suggest me some "well known" approach to follow? 回答1: Here is one way I handle this

JPA property java.net.URL

六眼飞鱼酱① 提交于 2019-11-29 03:50:39
HI, I have an object which has a piece of URL-Information associated with it. Currently I save this URL in a simple String property, but java.net.URL would provide me with additional goodies such as detection of malformed URLs etc. On the other hand I would consider it very ugly, if JPA simply created a LOB for the URL-Object. Does anyone know how a property of the type java.net.URL will be persisted to the database by compliant JPA providers? As per the JPA spec: The persistent fields or properties of an entity maybe of the following types: Java primitive types; java.lang.String; other Java

Java: Getting Bytecode of Class at Runtime from within the Same JVM

☆樱花仙子☆ 提交于 2019-11-29 03:48:11
Related to: Is there a way to obtain the bytecode for a class at runtime? I'm adding durability to Clojure, and I'm finally at the point where I'm ready to add functions. In Clojure, functions are byte compiled into classes with invoke methods (among others). In this way, functions are first class. To make these durable, I need to serialize and deserialize these classes. How do I get the bytecode for the class without having access to the .class file? Please correct me if I'm mistaken, but using an agent requires spawning a separate VM with the agent connecting to the first VM. I need to do it

Play Framework: PersistenceException: The type is not a registered entity? (Ebean)

时间秒杀一切 提交于 2019-11-29 03:45:52
问题 I'm following the Play Framework 2.0 tutorial for Java and get this error when trying to save an ebean Model ( task.save() ). [PersistenceException: The type [class models.Task] is not a registered entity? If you don't explicitly list the entity classes to use Ebean will search for them in the classpath. If the entity is in a Jar check the ebean.search.jars property in ebean.properties file or check ServerConfig.addJar().] 回答1: Check these 3 points : Your model is annotated with @Entity

How to do multiple column UniqueConstraint in hbm?

孤人 提交于 2019-11-29 02:57:14
Working on some legacy hibernate code. How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations? @Table(name="users", uniqueConstraints = { @UniqueConstraint(columnNames={"username", "client"}), @UniqueConstraint(columnNames={"email", "client"}) }) public class User implements Serializable { private static final long serialVersionUID = 1L; @Id private int id; private String username; private String email; private Client client; } Use the properties tag: ... <properties name="uk1" unique="true"> <property name="username" .../> <many-to-one name="client" .../> <

Wipe all data stored with CoreData when the model has changed

天大地大妈咪最大 提交于 2019-11-29 02:04:54
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 device, since I don't mind redownloading them all. It beats crashing and remapping the schema to the new one (in my case). I see that this check is performed in the getter: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator so I only need to know the

JPA Glassfish Database Update Issue

此生再无相见时 提交于 2019-11-29 01:26:41
问题 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 markEventAsProcessed(Long eventId) { try { AtlasEventQueueUpdateAsProcessedQuery setEventAsProcessed = new AtlasEventQueueUpdateAsProcessedQuery(entityManager, eventId); int