This usually happens if you mix HQL and native SQL queries. In HQL, bernate maps the types you pass in to whatever the DB understands. When you run native SQL, then you must do the mapping yourself.
If you don't, then the default mapping is to serialize the parameter and send it to the database (in the hope that it does understand it).
According to JPA Spec: "If an entity instance is to be passed by value as a detached object (e.g. , through a remote interface), the entity class must implement the Serializable interface. " "JSR 220: Enterprise JavaBeansTM,Version 3.0 Java Persistence API Version 3.0, Final Release May 2, 2006.
1 (+1) looking at the spec is always fruitful – Bozho Jan 7 '10 at 16:57.
You need your entities to be Serializable if you need to transfer them over-the-wire (serialize them to some other representation), store them in http session (which is in turn serialized to hard disk by the servlet container), etc. Just for the sake of persistence, Serializable is not needed, at least with But it is a best practice to make them Serializable.
I don't know, maybe my entities are being transferred implicitly somewhere. I use hibernate+spring+jsf and Tomcat. Where in this chain transferring can take place?
– Roman Jan 7 '10 at 14:31.
Classes must implement Serializable if you want to serialize them. This is not directly related to JPA and the JPA specification does not require that entities are serializable. If bernate really complains about this, I suppose it is a but I suppose that you directly or indirectly are doing something else with the entities, which require them to be serializable.
In our application, I noticed the same as none of the entities implements Serializable. I started to wonder why? We are using bernate for mapping and EJB 3/JPA for persistence.
I do not think it has anything to do with implementing Serializable. According to JPA specification as indicated above, Serializable is only required for Remote Interface. We are using Local Interface so I guess it is implicit and not required.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.