persistence

Is Hibernate / JPA taking in consideration the transient modifier ( not the annotation )

不羁岁月 提交于 2019-11-28 11:27:19
I want to avoid serialisation ( in JMS / AMF ) but still persist the field with JPA/Hibernate. Is the transient modifier my friend ? Are @Transient annotation and the transient modifier related or not a all ? The java specification precise that a transient field will not be saved to a persistent storage by a system service. But is hibernate a system service ? ( i dont think so ) http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78119 And java.io.Serialisable seams to indicate that a out.writeObject and in.readObject are called for serialisation http://download.oracle.com

Object persistence in Java applets

白昼怎懂夜的黑 提交于 2019-11-28 11:15:13
问题 What is a good approach to save state of a Java applet? I can deal with object serialization/deserialization to/from a file but don't know where it should be placed or if there's some 'registry' where I can just save a couple of user's settings. Those settings are hardware dependent so I want to save it on client. Full permission is given to the applet. 回答1: What is a good approach to save state of a Java applet? For a trusted applet, there are many options. I can deal with object

Can I access R data objects' attributes without fully loading objects from file?

蓝咒 提交于 2019-11-28 11:03:16
问题 Here's the situation. My R code is supposed to check whether existing RData files in application's cache are up-to-date. I do that by saving the files with names consisting of base64 -encoded names of a specific data element. However, data corresponding to each of these elements are being retrieved by submitting a particular SQL query per element, all specified in data collection's configuration file . So, in a situation when data for an element is retrieved, but afterwards I had to change

Spring MVC 3.0: How do I bind to a persistent object

我的梦境 提交于 2019-11-28 10:25:12
I'm working with Spring MVC and I'd like it to bind a a persistent object from the database, but I cannot figure out how I can set my code to make a call to the DB before binding. For example, I'm trying to update a "BenefitType" object to the database, however, I want it to get the object fromthe database, not create a new one so I do not have to update all the fields. @RequestMapping("/save") public String save(@ModelAttribute("item") BenefitType benefitType, BindingResult result) { ...check for errors ...save, etc. } There are several options: In the simpliest case when your object has only

Why are persisted user settings not loaded?

大兔子大兔子 提交于 2019-11-28 10:11:27
I have a windows application that uses an assembly that stores some configuration settings in the default application settings. The settings can be changed in run time and are persisted thus: Properties.Settings.Default.SelectedCOMPort = options.SelectedCOMPort; Properties.Settings.Default.Save(); The settings are saved correctly and I confirm this by looking at the user.config file saved in the users application directory E.g. C:\Documents and Settings\e399536\Local Settings\Application Data\MyCompany\MyTool However when the tool is closed and then started again all the settings are loaded

Internal HSQL database complains about privileges

做~自己de王妃 提交于 2019-11-28 09:55:26
I'm setting up a standalone Java service with an in-process, in-memory HSQL database. Persistence.xml <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_2_0.xsd" version="2.0"> <persistence-unit name="manager"> <class>tr.silvercar.data.entities.User</class> <properties> <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" /> <property name="javax.persistence.jdbc.user" value="sa" /> <property name=

How to use joda time with JPA (eclipselink)?

依然范特西╮ 提交于 2019-11-28 09:52:46
I tried to use the DataTime in my entity class. Adding @Temporal(TemporalType.DATE) above the field, I got the error saying "The persistent field or property for a Temporal type must be of type java.util.Date, java.util.Calendar or java.util.GregorianCalendar" . I can introduce the conversion back and forth; using setters and getters as follows: @Temporal(TemporalType.DATE) private Calendar attendanceDate; public DateTime getAttendanceDate() { return new DateTime(this.attendanceDate); } public void setAttendanceDate(DateTime attendanceDate) { this.attendanceDate = attendanceDate.toCalendar

is localStorage on iPad Safari guaranteed to be persistent?

心已入冬 提交于 2019-11-28 09:12:08
I've seen differences of opinion across the web on this. It has been said that starting with iOS 5.1, local data storage for HTML5 content on the iPad is no longer guaranteed to be persistent, however on Apple's current Safari developer pages ( https://developer.apple.com/technologies/safari/html5.html ), offline persistence is suggested to be guaranteed. Does anyone have any recent experience with this subject and able to comment on how reliable the database features of HTML5 are with Safari on iPad? This will probably be enough information: The w3c spec of localStorage is: The second storage

Can not find the declaration of element 'persistence'

萝らか妹 提交于 2019-11-28 09:10:16
Have put the persistence.xml in the classpath of the project in eclipse because before the error was that the file was not found. Now gives this error: Caused by: javax.persistence.PersistenceException: Invalid persistence.xml. Error parsing XML [line : -1, column : -1] : cvc-elt.1: Can not find the declaration of element 'persistence' <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_1.xsd"> <persistence

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

余生长醉 提交于 2019-11-28 08:19:22
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 an example method from my threadsafe DAO, @PersistenceContext(unitName = "PersistenceUnit", type = PersistenceContextType.TRANSACTION) private EntityManager em; public ErrorCode findErrorCodeById(short id) { return (ErrorCode) em.createNamedQuery("ErrorCode