I was too hasty to answer questions when I left the house in the morning. Now let’s talk about it in detail. Two points can be mentioned here:
Persistence
Deserialization
So PersistenceEveryone downstairs has mentioned that an object is saved to the storage system. In the case you mentioned, it is saved to the database. Then each attribute is generally used as a field, and then the value is saved as a record.
Then deserialization. The connection to the database is established through socket, so there is no doubt that it has gone through the network. If you need to transmit an object on the network, you must serialize it. In other words: The deserialization process has been completed when the ResultSet is obtained through the database link.
Generally, it is easier for interviewers to ask questionsJDBC就到底了吧,所以@泊浮目 所说的反序列化我觉得不是面试官的意思。用原生的JDBC执行SQL可以拿到ResultSet对象,框架不过是从里面取一个个字段值,然后封装到一个对象中而已。我的理解就是这样,也确实没看过这种ORM的源码,虽然我用Mybatis.
This has nothing to do with deserialization. The original JDBC query results in a ResultSet. Hibernate knows the correspondence between the fields and object properties in the ResultSet through xml configuration or Anotation, and then generates POJO objects through the reflection mechanism.
What a coincidence. Sixteen hours after you posted the question, I was asked the same question in the interview. My answer was basically the same as @Xing Aiming’s answer to this question. But looking at the reaction, I felt it was not what the interviewer wanted. Personally, I think this kind of question is quite strange. The main reason is that I can’t get the specific aspect I want to assess.
There is another question. I checked several times to make sure I heard it correctly, but I still don’t understand what it is.. What is the difference between jquery ${} and #{}? Pay attention to the curly brackets..
I was too hasty to answer questions when I left the house in the morning. Now let’s talk about it in detail. Two points can be mentioned here:
Persistence
Deserialization
So PersistenceEveryone downstairs has mentioned that an object is saved to the storage system. In the case you mentioned, it is saved to the database. Then each attribute is generally used as a field, and then the value is saved as a record.
Then deserialization. The connection to the database is established through
socket
, so there is no doubt that it has gone through the network. If you need to transmit an object on the network, you must serialize it. In other words: The deserialization process has been completed when the ResultSet is obtained through the database link.So first use sql and see how to use the original jdbc, and you will know why there is this framework
Generally, it is easier for interviewers to ask questions
JDBC
就到底了吧,所以@泊浮目 所说的反序列化我觉得不是面试官的意思。用原生的JDBC
执行SQL
可以拿到ResultSet
对象,框架不过是从里面取一个个字段值,然后封装到一个对象中而已。我的理解就是这样,也确实没看过这种ORM
的源码,虽然我用Mybatis
.This has nothing to do with deserialization.
The original JDBC query results in a ResultSet. Hibernate knows the correspondence between the fields and object properties in the ResultSet through xml configuration or Anotation, and then generates POJO objects through the reflection mechanism.
What a coincidence. Sixteen hours after you posted the question, I was asked the same question in the interview.
My answer was basically the same as @Xing Aiming’s answer to this question. But looking at the reaction, I felt it was not what the interviewer wanted.
Personally, I think this kind of question is quite strange. The main reason is that I can’t get the specific aspect I want to assess.
There is another question. I checked several times to make sure I heard it correctly, but I still don’t understand what it is..
What is the difference between jquery ${} and #{}? Pay attention to the curly brackets..