title: Generate SerialVersionUID for Java Class
body: <p>From heading it is expected to be the same old question but trust me this is different.</p>
  
  <p>I am working with an EJB3 and off course if I have to invoke it remotely I have to make all my data object implement Serializable interface. </p>
  
  <p>The problem is that most my data objects are generated (using Velocity Templates), compiled and package in one go. For now I hard coded the default serialVersionUID in every class as follows;</p>
  
  <pre><code>private static final long serialVersionUID = 1L;
  </code></pre>
  
  <p>But I am wondering if there is any way I can do following;</p>
  
  <pre><code>private static final long serialVersionUID = getSerialUID();
  private static long getSerialUID() {
      // Serial Version Algo code here
  }
  </code></pre>
  
  <p>Also, is there any problem in using Default serialVersionUID? Do I really need to generate a unique ID using Algo?</p>