[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-964?page=co...
]
Andrew Redhead commented on HBX-964:
------------------------------------
Maybe "implements Serializable" should be removed by default and then when
people actually want to implement Serializable they can make their own templates (and
choose to add serialVersionUID support if they want, making that support as complicated as
they like) ?
I've run into some situations where you do not want Serializable on your entities,
these include:
1) If your mappings include lazy-loading, serialising an object over to a remote jvm will
lead to the dreaded "LIE" unless you've put some thought into making sure
the lazy relationships are pre-initialised before serialisation (thought which might not
take place if the entities are just generated for you)
2) If your entities AREN'T serializable then you can get the Corba support in the Sun
JDK to generate the stubs for your enties - which makes interoperating with .Net apps
easy(ier) and avoids messing about with all sorts of type confusion with web-services
3) If you are putting your entities into the JBoss POJO treecache and you want to be sure
that you are using the field level replication then not having Serializable on your
entities means that if the cache falls back on using java serialisation then the "not
serializable" stack trace will let you know about it
4) I guess a contentious suggestion - If you are using shared classloading between your
"application tier" and your "presentation tier" and "call by
reference" rather than strict jee comliant "call by value" then there is no
need for serialisation at all...
I don't think that these cases form a compelling argument for removing Serializable
support but I really dont think the default templates should make much effort to support
it.
Cheers,
Andy
add serialVersionUID to entity classes
--------------------------------------
Key: HBX-964
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-964
Project: Hibernate Tools
Issue Type: Improvement
Components: hbm2java
Affects Versions: 3.2beta10
Reporter: Dan Allen
Priority: Minor
Attachments: HBX-964-v1.txt
Original Estimate: 5 minutes
Remaining Estimate: 5 minutes
The serialVersionUID is recommended for classes that implement java.io.Serializable. The
hbm2java task should either set the serialVersionUID to 1L or automatically generate a
value. I prefer setting it to 1L because it is easy and it will work, but if you feel
motivated, you can look at what Eclipse does to generate this value from the class
signature.
I have included a patch that just sets it to 1L.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira