Questions tagged [persist]
558 questions
1054
votes
16 answers
JPA EntityManager: Why use persist() over merge()?
EntityManager.merge() can insert new objects and update existing ones.
Why would one want to use persist() (which can only create new objects)?

Aaron Digulla
- 321,842
- 108
- 597
- 820
333
votes
24 answers
PersistentObjectException: detached entity passed to persist thrown by JPA and Hibernate
I have a JPA-persisted object model that contains a many-to-one relationship: an Account has many Transactions. A Transaction has one Account.
Here's a snippet of the code:
@Entity
public class Transaction {
@Id
@GeneratedValue(strategy =…

Paul Sanwald
- 10,899
- 6
- 44
- 59
77
votes
11 answers
Finding image type from NSData or UIImage
I am loading an image from a URL provided by a third-party. There is no file extension (or filename for that matter) on the URL (as it is an obscured URL). I can take the data from this (in the form of NSData) and load it into a UIImage and display…

pschang
- 2,568
- 3
- 28
- 23
73
votes
11 answers
Any way to pre populate core data?
I've been creating a list app and backing it with core data.
I would like to have a default list of say 10 airport's items, so that the user doesn't have to start from scratch.
Is there any way to do this?
Any help is appreciated.
Thanks in…

Tanner
- 813
- 1
- 7
- 12
68
votes
3 answers
JPA merge vs. persist
So far, my preference has been to always use EntityManager's merge() take care of both insert and update. But I have also noticed that merge performs an additional select queries before update/insert to ensure record does not already exists in the…

phewataal
- 1,107
- 4
- 12
- 23
36
votes
10 answers
AngularJS: Change hash and route without completely reloading controller
I have a controller, with a route like this:
#/articles/1234
I want to change the route without completely reloading the controller, so I can keep the position of other stuff in the controller constant (lists that scroll)
I can think of a few ways…

doubledriscoll
- 1,179
- 3
- 12
- 21
35
votes
3 answers
Spring-Data JPA: save new entity referencing existing one
The question is basically the same as below one:
JPA cascade persist and references to detached entities throws PersistentObjectException. Why?
I'm creating a new entity that references an existing, detached one. Now when I save this entity in my…

beginner_
- 7,230
- 18
- 70
- 127
28
votes
3 answers
Spark: Difference between Shuffle Write, Shuffle spill (memory), Shuffle spill (disk)?
I have the following spark job, trying to keep everything in memory:
val myOutRDD = myInRDD.flatMap { fp =>
val tuple2List: ListBuffer[(String, myClass)] = ListBuffer()
:
tuple2List
}.persist(StorageLevel.MEMORY_ONLY).reduceByKey { (p1,…

Edamame
- 23,718
- 73
- 186
- 320
20
votes
4 answers
How to persist objects between requests in PHP
I've been using rails, merb, django and asp.net mvc applications in the past. What they have common (that is relevant to the question) is that they have code that sets up the framework. This usually means creating objects and state that is persisted…

SztupY
- 10,291
- 8
- 64
- 87
20
votes
3 answers
How to persist an Array List of type Entity in JPA
How to persist an Array List of type Entity in JPA ?
For example, there is an entity called "Table".
I am creating an array list ArrayList table = new ArrayList();
Trying to persist it using entityManager.persist(table); and it did not…