Alex Rivera | Logout

Do Hibernate table classes need to be Serializable?

Asked 2010-04-28T01:31:03.840
59

I have inherited a Websphere Portal project that uses Hibernate 3.0 to connect to a SQL Server database.

There are about 130 Hibernate table classes in this project. They all implement Serializable. None of them declare a serialVersionUID field, so the Eclipse IDE shows a warning for all of these classes.

Is there any actual need for these classes to implement Serializable?
If so, is there any tool to add a generated serialVersionUID field to a large number of classes at once (just to make the warnings go away) ?

Edit
Report

2 Answers

5

Eclipse's "Clean Up" command can do that. However, it also does a lot more so test it and refine the cleanup and format settings before using it on an entire package.

answered 2010-04-28T01:54:29.080
2

I'm not familiar with a tool that would do it automatically for a bunch of classes, though you could write a script.

If you mechanically do it with Eclipse, it shouldn't take you more than 4-5 seconds per class which might still be faster than a script.

answered 2010-04-28T01:38:51.657

Your Answer