This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Transient, Persistance?  RSS feed

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! everyone
I am confused with the term transient and Persistance.
can anyone help me on these topics.
i'll be pleased if u'll give an example.
------------------
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajay
In Java when the class is implementing java.io.Serializable interface then the instance of that class can be written out to a disk or to a database. When the object is written out all the data belong to that object also written out.
If any variable is marked as "transient" that variable will not be written out to disk or to a database.
Example:
import java.io.*;
public class MyTransient implements Serializable {
// String s will be written out
public String s = "Test";
// String s1 will not be written out
public transient String s1 = "Test Transient" ;

public static void main ( String args[]) {
// here use the io methods to write out the object
}
}
Thanks
Konda Balabbigari
Web: http://www.javacaps.com
 
Ajay Singhal
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! Konda Balabbigari
thanX for ur information really transient is now clear to me.
will u please tell me something about persistance?


------------------
 
Konda Balabbigari
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ajay
Persistence is process ( mechanism ) of storing/retrieving the object's state from the relational database. This process is well defined in Enterprise JavaBeans becasue Entity Benas are persistable objects.
For example if any class implementing the java.io.Serializable interface ( it just a marker interface ) then that object's state can be stored in a database. The Serializable interface makes it posible.
I think Ajay you may not worry much about this for SCJP certification.
Thanks
Konda Balabbigari
Web: http://www.javacaps.com
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!