Questions tagged [persistence]

Persistence in computer programming refers to the capability of saving data outside the application memory.

Persistence is the capability of saving data outside of application memory, and of retrieving it later for further processing.

Typically data can be stored into the file system, in flat files or in a database. But persistence can also involve sending data to external applications.

Often persistence is related to .

References.

5099 questions
364
votes
6 answers

Saving an Object (Data persistence)

I've created an object like this: company1.name = 'banana' company1.value = 40 I would like to save this object. How can I do that?
Peterstone
  • 7,119
  • 14
  • 41
  • 49
264
votes
4 answers

Confusion: @NotNull vs. @Column(nullable = false) with JPA and Hibernate

When they appear on a field/getter of an @Entity, what is the difference between them? (I persist the Entity through Hibernate). What framework and/or specification each one of them belongs to? @NotNull is located within…
rapt
  • 11,810
  • 35
  • 103
  • 145
212
votes
10 answers

What are the differences between the different saving methods in Hibernate?

Hibernate has a handful of methods that, one way or another, takes your object and puts it into the database. What are the differences between them, when to use which, and why isn't there just one intelligent method that knows when to use what? The…
Henrik Paul
  • 66,919
  • 31
  • 85
  • 96
192
votes
1 answer

Unsure if I understand TransactionAwarePersistenceManagerFactoryProxy

I am trying to use the org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy in my Spring project, but I am not sure how to use it or whether it's exactly what I am looking for. I realize it can help make my DAOs work with a…
megazord
  • 3,210
  • 3
  • 23
  • 31
170
votes
33 answers

No Persistence provider for EntityManager named

I have my persistence.xml with the same name using TopLink under the META-INF directory. Then, I have my code calling it with: EntityManagerFactory emfdb = Persistence.createEntityManagerFactory("agisdb"); Yet, I got the following error…
Robert A Henru
  • 2,222
  • 4
  • 21
  • 25
164
votes
31 answers

Hibernate: "Field 'id' doesn't have a default value"

I'm facing what I think is a simple problem with Hibernate, but can't solve it (Hibernate forums being unreachable certainly doesn't help). I have a simple class I'd like to persist, but keep getting: SEVERE: Field 'id' doesn't have a default…
André Chalella
  • 13,788
  • 10
  • 54
  • 62
141
votes
10 answers

What is Persistence Context?

I am new to the Java world and JPA. I was studying JPA and came across many new terms like Entity, persistence. While reading, I could not understand the exact definition for Persistence Context. Can anyone explain it in simple laymen terms? What is…
Amrit
  • 2,295
  • 4
  • 25
  • 42
132
votes
3 answers

Correct use of flush() in JPA/Hibernate

I was gathering information about the flush() method, but I'm not quite clear when to use it and how to use it correctly. From what I read, my understanding is that the contents of the persistence context will be synchronized with the database, i.…
MicSim
  • 26,265
  • 16
  • 90
  • 133
127
votes
4 answers

Java Persistence / JPA: @Column vs @Basic

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?
Hosam Aly
  • 41,555
  • 36
  • 141
  • 182
125
votes
5 answers

Name attribute in @Entity and @Table

I have a doubt, because name attribute is there in both @Entity and @Table For example, I'm allowed to have same value for name attribute @Entity(name = "someThing") @Table(name = "someThing") and I can have different names as well for same class …
user2728475
120
votes
5 answers

How persistent is localStorage?

I'm depending heavily on localStorage for a plugin I'm writing. All the user settings are stored in it. Some settings require the user the write regex'es and they would be sad if their regex rules are gone at some point. So now I am wondering just…
PeeHaa
  • 71,436
  • 58
  • 190
  • 262
118
votes
5 answers

When to use EntityManager.find() vs EntityManager.getReference() with JPA

I have come across a situation (which I think is weird but is possibly quite normal) where I use the EntityManager.getReference(LObj.getClass(), LObj.getId()) to get a database entity and then pass the returned object to be persisted in another…
SibzTer
  • 1,737
  • 4
  • 14
  • 18
103
votes
4 answers

Persistence unit as RESOURCE_LOCAL or JTA?

I have queries as below: What is the difference of these two? Are both of these supported by all databases? Are JPA TransactionManager and JTA TransactionManager different?
cometta
  • 35,071
  • 77
  • 215
  • 324
101
votes
2 answers

What do REFRESH and MERGE mean in terms of databases?

I'm curious and need to find this answer quick. Google won't help much. The Java Persistence API has these properties that tell the framework to cascade operations on associated…
André Chalella
  • 13,788
  • 10
  • 54
  • 62
89
votes
2 answers

What do the acronyms AOF and RDB stand for in Redis?

I'm reading the Redis documentation on persistence here - https://redis.io/topics/persistence - and am wondering what the acronyms AOF and RDB stand for. Thanks! :)
Simon Suh
  • 10,599
  • 25
  • 86
  • 110
1
2 3
99 100