I have just used the same code but i am not getting any errors? Is is somthing to do with jdk version?
Joined: Apr 13, 2003
This is not an error. It is only a suggestion to provide a UID when using a serializable class. I get it when using eclipse. The original post mentions JBoss also. Maybe you're IDE isn't generating it or you may have turned it off.
As mentioned by Anupam, it is a setting at Eclipse end as a warning when the code is compiled. If you have changed it to be flagged as an error, then Eclipse will report it as an error.
To ans your other question.. What serialVersionUID is.. Well it is a unique identifier for a class that can be serialized. All classes that can be serialized implement the marker interface java.io.Serializable. It is a mechanism using which JVM checks if the class had changed after it was serialized into a persistent medium. Example: I have UserBean class which had the following code: