Results 1 to 6 of 6

Thread: What are the Bean Persistence?

  1. #1
    Join Date
    Aug 2006
    Posts
    332

    What are the Bean Persistence?

    Hello Friends,
    You helped me a lot while solving my issue last time. So I thought that this time also I should post here. I have just started with the Java Beans. I am not having much idea about it. I have done the Juggler's program in that. I am confused with the bean persistence. Can anyone please explain me what is the Bean Persistence.?? Any other information related to the same topic would be grateful.!!
    Do not email me asking for tech support. Any private support is billable at $50 an hour.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: What are the Bean Persistence?

    When the properties, fields, and state information of a bean are saved to and retrieved from storage, then they have the property of persistence. The EJB specification intends to provide a standard way to implement the back-end 'business' code. Such conditions are found in an in enterprise applications. To persist, your Beans must support serialization by implementing either the java.io.Serializable interface, or the java.io.Externalizable interface.

  3. #3
    Join Date
    Mar 2008
    Posts
    672

    Re: What are the Bean Persistence?

    You have known the interface requires for the persistence. You can also control the level of serialization. The followings are the ways that your bean follows :
    • Automatic: implement Serializable. You have to do nothing. Each and everything gets serialized by the Java serialization software.
    • If the Beans are written to a specific file format: implement Externalizable, and its two methods.
    • Selectively exclude fields you do not want serialized by marking with the transient (or static) modifier.

  4. #4
    Join Date
    Mar 2008
    Posts
    349

    Re: What are the Bean Persistence?

    You can also do the selective serialization using the transient Keyword. You will have to keep in mind that you have to use the transient modifier to specify fields you do not want serialized, and to specify classes that are not serializable. If you want to exclude fields from serialization in a Serializable object mark the fields with the transient modifier. The following shows an example of the same :
    Code:
    transient int status;
    If the serialization is default, then it will not serialize transient and static fields.

  5. #5
    Join Date
    Nov 2008
    Posts
    1,192

    Re: What are the Bean Persistence?

    If you are having serializable class which contains writeObject or readObject with an exact signatures, then the default serialization will not take place. Seeing at the following, you may understand more better :
    Code:
    private void writeObject(java.io.ObjectOutputStream out)
        throws IOException;
    private void readObject(java.io.ObjectInputStream in)
        throws IOException, ClassNotFoundException;
    By writing your own implementations of the writeObject and readObject methods, you can control how more complex objects are serialized.

  6. #6
    Join Date
    Jul 2006
    Posts
    289

    Re: What are the Bean Persistence?

    When you are studying about the Bean Persistence, it is necessary to know about the Serializable interface. So I thought that providing some points on it would be useful for you. The following are the some points about working with the Serializable interface :
    • If the Serializable is implemented in a superclass, then you don't have to implement Serializable in your class.
    • Classes that implement Serializable must have an access to a no-argument constructor of supertype.
    • All fields except static and transient fields are serialized.
    Signatures reduce available bandwidth

Similar Threads

  1. Persistence Module Stopped Working in Windows Vista
    By Dakshi in forum Windows Vista Performance
    Replies: 3
    Last Post: 14-01-2014, 09:41 AM
  2. What is new in Android 4.1 Jelly Bean
    By Kaesav in forum Portable Devices
    Replies: 7
    Last Post: 29-06-2012, 05:00 PM
  3. Hibernate with Java Persistence API
    By Valliy in forum Software Development
    Replies: 5
    Last Post: 18-09-2010, 10:06 PM
  4. Java Persistence with JDO
    By Fragant in forum Software Development
    Replies: 5
    Last Post: 31-07-2010, 04:41 AM
  5. What is the Bean Context : Containment Only?
    By NGV BalaKrishna in forum Software Development
    Replies: 4
    Last Post: 17-02-2010, 06:47 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,205,489.39995 seconds with 17 queries