Pages

Thursday, June 23, 2011

NetBeans 7.0 Tip: Generating SerialVersionUID for Serializable Objects

If you are doing any work on a class which implements Serializable, you should take the time to generate a unique serialVersionUID for the class. By default, the IDE will add a serialVersionUID which is defined as 1L.This is a rather poor substitute for doing it correctly. The serialVersionUID is extremely important in Web Development (Session scoped beans must be Serializable), and in Java Persistence API (JPA) which needs to be able to serialize entities.

I have covered this plugin in a previous blog post, but there is an updated NetBeans plugin to help you with serialization. The Kenai project is located here: serialVersionUID generator for Netbeans. The actual downloadable nbm for NetBeans 7.0 is located here: eu-easyedu-netbeans-svuid.nbm. It was the first plugin I looked for when I installed NetBeans 7.0.
Enhanced by Zemanta

4 comments:

  1. This NBM seems to cause big problems with Netbeans 7 on OSX Snow Leopard. Just in case anyone else runs across this...

    ReplyDelete
  2. Mark,

    I am running all of my work on OS X Snow Leopard, and I am not having any issues. What are the issues that you are noticing?

    ReplyDelete
  3. I just checked that the link to the NBM is pointed at the NB 7 NBM. Can you verify that you used the NB 7 NBM, or did you download it from the project site directly?

    ReplyDelete
  4. Nice plugin for serialVersionUID. thanks for sharing.

    serialVersionUID in Java Serialization

    ReplyDelete