persistence

Java Persistence / JPA: @Column vs @Basic

半腔热情 提交于 2019-11-29 18:54:17
What is the difference between @Column and @Basic annotations in JPA? Can they be used together? Should they be used together? Or does one of them suffice? djna @Basic signifies that an attribute is to be persisted and a standard mapping is to be used. It has parameters which allow you to specify whether the attribute is to be lazily loaded and whether it's nullable. @Column allows you to specify the name of the column in the database to which the attribute is to be persisted. If you specify one without the other then you get default behaviour which is sensible, so commonly folks use only one

How to use Slick's mapped tables with foreign keys?

瘦欲@ 提交于 2019-11-29 18:30:10
问题 I'm struggling with Slick's lifted embedding and mapped tables. The API feels strange to me, maybe just because it is structured in a way that's unfamiliar to me. I want to build a Task/Todo-List. There are two entities: Task: Each task has a an optional reference to the next task. That way a linked list is build. The intention is that the user can order the tasks by his priority. This order is represented by the references from task to task. TaskList: Represents a TaskList with a label and a

one to many relationship in java google ap engine caused error ?

只谈情不闲聊 提交于 2019-11-29 18:03:06
i have implement a system to save information about user . So i have aggregation at my class so the user class has list from contact class ...etc in the first page "test it's just for register the user just by phone number " that must save the user in database but this cause error when i deploye my project in Google app engine < 500 server error > and the other page for update the exist user who previously has been registered, so at this will add to the list which the user object has . user class @PersistenceCapable public class User implements Serializable{ @PrimaryKey @Persistent

How to store local data after user delete my iOS app?

一笑奈何 提交于 2019-11-29 17:55:36
问题 I thought it's impossible, because all the data store in a sandbox, when user delete the app, all the data should be removed from the device. But somehow, this happened: I downloaded a wallpaper app from the appstore. It's a free app, if you don't pay, you can download limited wallpapers, up to 105. I download a wallpaper and save to my album. it's now 1/105. I delete the app, and delete the wallpaper in my album. I turn off the iCloud backup function. OK, It's totally removed from my device,

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

一世执手 提交于 2019-11-29 17:04:11
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 that particular SQL query, data is not being updated. In order to handle this situation, I decided to use

Object persistence in Java applets

我是研究僧i 提交于 2019-11-29 17:02:10
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. Andrew Thompson 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 serialization/deserialization to/from a file but don't know where it should be placed.. Put the

JPA query.getResultList()?

元气小坏坏 提交于 2019-11-29 16:22:36
I use JPA 1.0: Query query; query = em.createNamedQuery("getThresholdParameters"); query.setParameter(1, Integer.parseInt(circleId)); List<Object[]> resultList = new ArrayList(); resultList = query.getResultList(); Here I get result as List<Object[]> , thus I have to type convert all the parameters of the row to their respective types which is cumbersome. In JPA 2.0 there is TypedQuery which return an entity object of type one specifies. But as I am using JPA 1 I can't use it. How to get result as Entity object of type I want?? EDIT: QUERY @Entity @Table(name="GMA_THRESHOLD_PARAMETERS")

Configuration to be able to @Inject EntityManager in Seam 3

落花浮王杯 提交于 2019-11-29 15:39:26
问题 In my project I use Seam 3 and I am having issues injecting the EntityManager with the @Inject annotation. I am pretty sure there is some kind of configuration to make sure the EnityManager knows which PersistenceUnit to use. For example with EJB you can type: @PersistenceContext(unitName="MY_PERSISTENCE_UNIT_NAME") private EntityManager eManager; which persistence unit is configured in the persistence.xml file. Here is my pseudo configuration: <?xml version="1.0" encoding="UTF-8"?>

Prevent a console app from closing when not invoked from an existing terminal?

随声附和 提交于 2019-11-29 14:11:23
问题 There are many variants on this kind of question. However I am specifically after a way to prevent a console application in Python from closing when it is not invoked from a terminal (or other console, as it may be called on Windows). An example where this could occur is double clicking a .py file from the Windows explorer. Typically I use something like the following code snippet, but it has the unfortunate side effect of operating even if the application is invoked from an existing terminal

Persist OneToOne relation with SpringData JPA

孤人 提交于 2019-11-29 14:08:20
问题 I have the next two entities with a OneToOne relation between them: @Entity @Table(name = "tasks") public class Task { @OneToOne(mappedBy = "task", cascade = CascadeType.PERSIST) private Tracker tracker; /* More code */ } @Entity @Table(name = "trackers") public class Tracker { @OneToOne @JoinColumn(name = "trk_task", unique = true) private Task task; /* More code */ } I'm trying to run this code: Task task = taskService.findDispatchableTask(); if (task != null) { Tracker tracker =