why hibernate forcing serialization in session.get method

前端 未结 4 1552
故里飘歌
故里飘歌 2021-01-03 04:48

I see that hibernate\'s session.get() and load() methods is accepting only Serializable objects.

As per my understanding of hibernate, it will generate an SQL statem

4条回答
  •  悲&欢浪女
    2021-01-03 05:20

    I frankly don't see it any other way. If you are not the one defining table structure and generating insert statements to accommodate for objects, then the SQL statement generated is a string in itself and it would insert another string of text (your serialized data) into a field of a table. Whatever you insert into a database has to be a string in this case, it cannot be an object with language dependent methods, unless you explicitly design an table to store data like that.

提交回复
热议问题