persistence

BlackBerry Persistent store

旧时模样 提交于 2019-12-23 05:12:17
问题 I am developing an application in which I want to store many data entries using persistent store. the problem is whenever new entry is made it replaces the existing entry. here is my code please help me. import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.system.*; import net.rim.device.api.util.*; import java.util.*; /*An application in which user enters the data. this data is displayed when user press

Quick question about sessions in PHP

末鹿安然 提交于 2019-12-23 04:54:11
问题 Sessions are started via session_start() , I realize that much, but to make sessions persistent, they need an ID. Now, the php.ini file has a setting: session.use_cookies = 1 So I don't have to pass the ID around. But there's another setting: ; Lifetime in seconds of cookie or, if 0, until browser is restarted. session.cookie_lifetime = 0 Am I to understand that if I implement this and go to my website, login, do what I wanna do, shut the browser down and start it again some time later, that

How to persist Ruby class variables across page loads in Rails?

試著忘記壹切 提交于 2019-12-23 04:06:14
问题 I have a class variable that I would like to set from an initilizer and have the value kept from then on. The example below works for only the first page load. Is there a better way to do this? app/models/token.rb class Token class << self attr_accessor :salt end end config/initilizers/token.rb Token.salt = "savory hash" 回答1: In development mode, your class is going to get reloaded with every request, so the value that's set in an initializer at app startup will not persist when the class is

Why is isolated storage not persisting in my WP7 application?

戏子无情 提交于 2019-12-23 03:22:17
问题 I am using IsolatedStorageSettings.ApplicationSettings for my application. All code associated with Isolated storage occurs in my Application_Launching, Application_Activated, Application_Closing, and Application_Deactivated methods as follows: public IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; private void Application_Launching(object sender, LaunchingEventArgs e) { if (settings.Contains("myObjList")) { App.ObjList = (ObservableCollection<myObj>)settings[

Hibernate LazyInitializationException on find() with EAGER @ElementCollection

非 Y 不嫁゛ 提交于 2019-12-22 22:48:42
问题 I am getting org.hibernate.LazyInitializationException: illegal access to loading collection in my JPA code - all collections are EAGER fetch - when the collection entity also has a collection. Could somebody please help me to fix this? I have isolated a problem in my JPA code to the following @Entity definitions: (note, I'm skipping the package and import statements to shorten the code. Some Lombok annotations are used, such as @Data to mean that the field has a getter/setter and @Cleanup to

How can I prevent Eclipselink from consuming all memory with the cache?

和自甴很熟 提交于 2019-12-22 18:33:49
问题 My application extracts large amounts of geometry data. I use Eclipselink 2.4.1 to persist that data in a MySQL database. The application works batch-style, i.e. I gather a set of data, then persist it, and continue with the next set, persist it and so on. Another application later reads that data and processes it, but this question is only about the first application that gathers the data. The data-gathering application runs for quite some time. I use a fixed set of EntityManagers which are

Cant inject Bean class into Restfull WebService (JAX-RS) [duplicate]

亡梦爱人 提交于 2019-12-22 12:38:15
问题 This question already has answers here : Inject an EJB into JAX-RS (RESTful service) (7 answers) Closed 3 years ago . I'm trying to save data acquired by Rest web service to database using hibernate/persistence. In one of my web modules i implemented that service. Database ejb connector is placed in EJB module. They are parts of EAR application. Every time when i call pb.addDevice() im getting java.lang.NullPointerException when puting proper url with params in browser(worked till i wanted to

JPA: How to get Id after persist in standalone java app

血红的双手。 提交于 2019-12-22 09:43:43
问题 This is a standalone java application, not web application. So when I persist the object like this public <T> T create(T t) { em.getTransaction().begin(); em.persist(t); em.flush(); em.getTransaction().commit(); return t; } The id inside the T t object is still null, even though a new row with correct data and id is created correctly inside the database. Usually in my web app that utilize @EJB , the id available right after I persist, since it persist the entity object into my persistence

Hibernate, Persistence and @OneToMany and @ManyToOne annotations problems

烈酒焚心 提交于 2019-12-22 09:22:03
问题 I have some problem with @OneToMany and @ManyToOne annotations. I have two class Suite and SuiteVersion. A SuiteVersion is dependent of a suite. So i have implemented this in my code: Class Suite : @OneToMany(mappedBy = "suite") @Cascade(CascadeType.DELETE_ORPHAN) private List<SuiteVersion> listSuiteVersion = new ArrayList<SuiteVersion>(); Class SuiteVersion : @ManyToOne() @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) private Suite suite; But i have some problem when i delete

Why is it necessary to annotate mapped Date fields @Temporal in javax.persistence?

梦想与她 提交于 2019-12-22 08:47:22
问题 The format goes like this: @Temporal(TemporalType.DATE) @Column(name="CREATED_DATE") private Date createdDate; My question is: Why is it necessary to annotate mapped java.util.Date fields as @Temporal in javax.persistence? If the local variable is obviously declared as a Date and the column data type in the DB is also one of the date(time) or timestamp types, shouldn't it be easy to infer that we're dealing with a temporal bit of data without redundantly specifying it in multiple places? 回答1: