MindBrain
MindBrain

Reputation: 7768

Persisting Java Beans

I am new to Java Beans. I have read that in order for the Java Beans to be persisted their class has to extend the Serializable class. Till when do they remain persisted ? Is it till the JVM is restarted ?

Upvotes: 2

Views: 345

Answers (2)

Srinath Thota
Srinath Thota

Reputation: 1248

Persistence means saving them to the database. We have many ORM(Object Relational Mapping) libraries in java like Hibernate,Data Nucleus,etc . You can persist the Java bean object in to the database using the ORM libraries and when you fetch from database again you can have the collection of Java Bean objects.

Upvotes: 1

Vineet Kasat
Vineet Kasat

Reputation: 1014

It depends where you have persisted the data.

If you have persisted data into a file then it will remain till you delete the file explicitly. This file could be used to reconstruct the object whenever required.

If you persist data over a wire and reconstruct the object again then it will remain depending on its scope (Garbage collection) and will definitely be removed once JVM is killed.

Upvotes: 2

Related Questions