persistence

Blackberry: how to make a data structure (for example Hashtable) persistable?

风格不统一 提交于 2019-12-24 09:40:12
问题 I have this code which works well: static { myStore = PersistentStore.getPersistentObject(MY_LONG_KEY); myList = (Vector) myStore.getContents(); if (_storedStations == null) { myList = new Vector(4); // prepopulate with fake data myList.addElement(new MyItem("Eins")); myList.addElement(new MyItem("Zwei")); myList.addElement(new MyItem("Drei")); myList.addElement(new MyItem("Vier")); myStore.setContents(myList); } } class MyItem implements Persistable { ..... } probably because the

Automatically create Entities from database

不羁的心 提交于 2019-12-24 08:59:15
问题 Is there a way to automatically create javax.persistence.Entity classes from an existing database (or from the SQL statements that created them)? I am just reading through the persistence part of The Java EE 5 Tutorial and creating all these annotations by hand seems rather wasteful considering that all (or most) of the necessary knowledge is already encoded in the database or even explicitly given in the form of SQL statements. 回答1: There are several attemps to reverse engineer databases to

Alternatives of persisting data using C#?

霸气de小男生 提交于 2019-12-24 07:14:11
问题 I have a small application in C#, and so far I have implemented it using data persistence classes that are running SQL directly, I understand there are better alternatives as Hibernate.NET and possibly Spring.NET. There are some other I forget? pros and cons? thanks! 回答1: Here are a few of the more common ones: LINQ to SQL ADO.NET Entity Framework NHibernate Plain old ADO.NET SubSonic Spring.NET isn't really a dedicated data persistence framework. It's more of a IoC (Inversion of Control)

A little bit diffrent GWT/GXT persistent approach

拟墨画扇 提交于 2019-12-24 03:52:54
问题 I'm newbie with GWT/GXT and I'm looking for best persistence way for my future apps. I was considering many variants of doing that so I decided to draw a graph here: So my conclusions are: 1) JPA/Hibernate is the best persistence framework but it hates cooperation with GWT and a specially with GXT 2) JDBC it was just an example joke :) 3) MyBatis is really great tool for gaining data from db, its fast, efficient and has great possibilities not seen in Hibernate, but writing mappers is the

Getting generated identifier for JPA native insert query

末鹿安然 提交于 2019-12-24 03:39:27
问题 For performance reasons I need to use some native queries to insert new objects into a database. I have a very sophisticated JPA persistence layer which manages my usual entity reading and writing and I would like to use this persistence layer to run the native queries. I know I need the methods EntityManager#createNativeQuery(String) and Query#executeUpdate to achieve my goal. My current problem is that I would also like to get the generated identifier of the newly inserted row. I know this

How to create Objects in database if does not exists with JPA?

夙愿已清 提交于 2019-12-24 02:39:10
问题 I have a web application that I use JPA / Hibernate I want to know how to hibernate can generate the non-existent tables from entities. the persistence file is as follows: What I can add as property ? <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="BankingApp"> <provider>

how to save the state in userdefaults of accessory checkmark-iphone

a 夏天 提交于 2019-12-24 02:17:11
问题 I am working on an application having UItableView . In the rows of the table i am able to put checkmarks.Now how to save the state of checkmarks so that even if user close the application the state should be shaved and in the next launch of application checkmark should be shown. i have followed the tutorials on NSUSerDefaults but Pulling my hairs where to put the codes of saving and retrieving.I have tried but every time errors are stuffing me and not able to fix. My Code: MY.h file **

ORA-01400: Cannot insert null into (TABLE.COLUMN) (Hibernate)

谁说我不能喝 提交于 2019-12-24 02:16:35
问题 I'm using hibernate 4.3, oracle 11: When I want to insert an employee, (it have a relationship one to many with category (one category have many employees)), first I Insert a category to db, then I try to insert an employee to the db and get an exception, the code of the entities was generated by hibernate, so I don't know what's wrong, The problem seems to be that Hibernate is not inserting ID_CAT when I'm inserting an employee, what im doing wrong? I also tried to generate tables from

c#.NET USB device persistent identifier

纵饮孤独 提交于 2019-12-24 01:50:55
问题 I am looking for a way in C# to have a persistent (across when end-users unplug a hub/restart their computer) identifier for USB slots, more specifically, SD card readers. Drive letters are not always assigned to the same slot, but I need a way to identify Slot A physically; as once I can identify it, I can make the connections to a drive letter. So my question(s): Is this possible? If so, how would I go about getting these identifiers? 回答1: WMI class Win32_USBHub. ManagementObjectSearcher

How to de-serialize an entity, put it in managed context, but not persist any changes?

余生颓废 提交于 2019-12-24 00:35:10
问题 I'm new to persistence and I want to do the following: 1) Load a part of database into entities and store them in a file 2) Load these entities from file, put them in managed context (so that all the @JoinColumn and @JoinTable, especially those with lazy fetch type, would work normally) and make sure that I don't accidentally update database with them. The point of all that is that every time I start the application I don't want to call database for the table that almost never change - so I