POJO Classes being serialized with no read/write usage
up vote
1
down vote
favorite
I am new to SPRING and was assigned to work on project currently under development. Unfortunately development of the project has been slow so people have come and gone so I cant ask them why some things were done a certain way.
The project is a web service using SPRING.
They are using a View - Controller - Service (interface & implementation) - DAO (interface & implementation) - POJO (class used to transport data structure across layers).
Every POJO I have checked implementations serialization. On closer examination and search of the code, none of the POJO's are ever written or read, either in the POJO itself or any other file. Which has lead me to ask why its being done.
The POJO's are populated from Oracle statements in the DAO, which bubble upto the view, and then will bubble back down to the DAO where they information from them are written to the database using Oracle statements. The POJO itself is not written into the database.
Does SPRING MVC or java web applications require serialization and it is being used in the background? Is it needed to transmit the data between server and client connections? Is there a good reason that all the POJO's are using it that someone new would not recognize?
java spring oracle serialization pojo
add a comment |
up vote
1
down vote
favorite
I am new to SPRING and was assigned to work on project currently under development. Unfortunately development of the project has been slow so people have come and gone so I cant ask them why some things were done a certain way.
The project is a web service using SPRING.
They are using a View - Controller - Service (interface & implementation) - DAO (interface & implementation) - POJO (class used to transport data structure across layers).
Every POJO I have checked implementations serialization. On closer examination and search of the code, none of the POJO's are ever written or read, either in the POJO itself or any other file. Which has lead me to ask why its being done.
The POJO's are populated from Oracle statements in the DAO, which bubble upto the view, and then will bubble back down to the DAO where they information from them are written to the database using Oracle statements. The POJO itself is not written into the database.
Does SPRING MVC or java web applications require serialization and it is being used in the background? Is it needed to transmit the data between server and client connections? Is there a good reason that all the POJO's are using it that someone new would not recognize?
java spring oracle serialization pojo
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am new to SPRING and was assigned to work on project currently under development. Unfortunately development of the project has been slow so people have come and gone so I cant ask them why some things were done a certain way.
The project is a web service using SPRING.
They are using a View - Controller - Service (interface & implementation) - DAO (interface & implementation) - POJO (class used to transport data structure across layers).
Every POJO I have checked implementations serialization. On closer examination and search of the code, none of the POJO's are ever written or read, either in the POJO itself or any other file. Which has lead me to ask why its being done.
The POJO's are populated from Oracle statements in the DAO, which bubble upto the view, and then will bubble back down to the DAO where they information from them are written to the database using Oracle statements. The POJO itself is not written into the database.
Does SPRING MVC or java web applications require serialization and it is being used in the background? Is it needed to transmit the data between server and client connections? Is there a good reason that all the POJO's are using it that someone new would not recognize?
java spring oracle serialization pojo
I am new to SPRING and was assigned to work on project currently under development. Unfortunately development of the project has been slow so people have come and gone so I cant ask them why some things were done a certain way.
The project is a web service using SPRING.
They are using a View - Controller - Service (interface & implementation) - DAO (interface & implementation) - POJO (class used to transport data structure across layers).
Every POJO I have checked implementations serialization. On closer examination and search of the code, none of the POJO's are ever written or read, either in the POJO itself or any other file. Which has lead me to ask why its being done.
The POJO's are populated from Oracle statements in the DAO, which bubble upto the view, and then will bubble back down to the DAO where they information from them are written to the database using Oracle statements. The POJO itself is not written into the database.
Does SPRING MVC or java web applications require serialization and it is being used in the background? Is it needed to transmit the data between server and client connections? Is there a good reason that all the POJO's are using it that someone new would not recognize?
java spring oracle serialization pojo
java spring oracle serialization pojo
asked Nov 7 at 17:37
Fering
1288
1288
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54
add a comment |
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54
add a comment |
3 Answers
3
active
oldest
votes
up vote
0
down vote
Use of Java's default serialization is a normal way for regular POJOs.
Java specifies a default way in which objects can be serialized. Java classes can override this default behavior. Custom serialization can be particularly useful when trying to serialize an object that has some unserializable attributes.
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
add a comment |
up vote
0
down vote
Depends on technologies used in the layers as well as implementation details.
If persistence is done using JPA/Hibernate then POJOs most likely will need to be Serializable.
In case if the POJO is passed to view via servlet session and session replication is on then you need to have your POJOs Serializable.
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
add a comment |
up vote
0
down vote
accepted
This might not be the correct answer, but so far in my case it matches and explains what I am seeing. I have not seen this information mentioned else where, but the answer is well upvoted, has been around for awhile, and is from a high reputation user, so I am inclined to trust it.
There is an answer from another question where they mention something important.
As to the why you need to worry about serialization, this is because most Java servlet containers like Tomcat require classes to implement Serializable whenever instances of those classes are been stored as an attribute of the HttpSession. That is because the HttpSession may need to be saved on the local disk file system or even transferred over network when the servlet container needs to shutdown/restart or is being placed in a cluster of servers wherein the session has to be synchronized.
The application Im working on DOES use Tomcat, so if this is a restriction or behavior, then I can easily see why all the POJO's are created in this fashion, simply to avoid issues that might develop later, and is a result of experience having worked with this all before, and its that experience that I am lacking.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Use of Java's default serialization is a normal way for regular POJOs.
Java specifies a default way in which objects can be serialized. Java classes can override this default behavior. Custom serialization can be particularly useful when trying to serialize an object that has some unserializable attributes.
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
add a comment |
up vote
0
down vote
Use of Java's default serialization is a normal way for regular POJOs.
Java specifies a default way in which objects can be serialized. Java classes can override this default behavior. Custom serialization can be particularly useful when trying to serialize an object that has some unserializable attributes.
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
add a comment |
up vote
0
down vote
up vote
0
down vote
Use of Java's default serialization is a normal way for regular POJOs.
Java specifies a default way in which objects can be serialized. Java classes can override this default behavior. Custom serialization can be particularly useful when trying to serialize an object that has some unserializable attributes.
Use of Java's default serialization is a normal way for regular POJOs.
Java specifies a default way in which objects can be serialized. Java classes can override this default behavior. Custom serialization can be particularly useful when trying to serialize an object that has some unserializable attributes.
answered Nov 7 at 17:46
user7294900
18.4k93056
18.4k93056
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
add a comment |
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
I actually used that article to perform my searches to see if they were actually being read or written anywhere.
– Fering
Nov 7 at 17:52
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
@Fering you will add serialization if you can have circular (object as a member of itself) serialization for example
– user7294900
Nov 7 at 17:57
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
I went and looked, but I dont see any circular serialization happening. It was a quick look so I might have missed something, but all I am seeing is that the class is used in a list to represent the database information, is sent up to the view, and then brought back down and put into the database if something was changed.
– Fering
Nov 7 at 18:05
add a comment |
up vote
0
down vote
Depends on technologies used in the layers as well as implementation details.
If persistence is done using JPA/Hibernate then POJOs most likely will need to be Serializable.
In case if the POJO is passed to view via servlet session and session replication is on then you need to have your POJOs Serializable.
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
add a comment |
up vote
0
down vote
Depends on technologies used in the layers as well as implementation details.
If persistence is done using JPA/Hibernate then POJOs most likely will need to be Serializable.
In case if the POJO is passed to view via servlet session and session replication is on then you need to have your POJOs Serializable.
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
add a comment |
up vote
0
down vote
up vote
0
down vote
Depends on technologies used in the layers as well as implementation details.
If persistence is done using JPA/Hibernate then POJOs most likely will need to be Serializable.
In case if the POJO is passed to view via servlet session and session replication is on then you need to have your POJOs Serializable.
Depends on technologies used in the layers as well as implementation details.
If persistence is done using JPA/Hibernate then POJOs most likely will need to be Serializable.
In case if the POJO is passed to view via servlet session and session replication is on then you need to have your POJOs Serializable.
answered Nov 7 at 17:48
tsolakp
4,46611219
4,46611219
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
add a comment |
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
Why would JPA entities need to be serializable?
– chrylis
Nov 7 at 17:58
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
@chrylis stackoverflow.com/questions/2020904/…
– tsolakp
Nov 7 at 18:05
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
That question doesn't actually have any correct answers. The accepted answer is nonsense.
– chrylis
Nov 7 at 19:13
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
The point of the link is not the accepted answer but fact that you can potentially run into not serializable entity exception with Hibernate and it has become a practice to mark JPA entities as serializable.
– tsolakp
Nov 7 at 19:50
add a comment |
up vote
0
down vote
accepted
This might not be the correct answer, but so far in my case it matches and explains what I am seeing. I have not seen this information mentioned else where, but the answer is well upvoted, has been around for awhile, and is from a high reputation user, so I am inclined to trust it.
There is an answer from another question where they mention something important.
As to the why you need to worry about serialization, this is because most Java servlet containers like Tomcat require classes to implement Serializable whenever instances of those classes are been stored as an attribute of the HttpSession. That is because the HttpSession may need to be saved on the local disk file system or even transferred over network when the servlet container needs to shutdown/restart or is being placed in a cluster of servers wherein the session has to be synchronized.
The application Im working on DOES use Tomcat, so if this is a restriction or behavior, then I can easily see why all the POJO's are created in this fashion, simply to avoid issues that might develop later, and is a result of experience having worked with this all before, and its that experience that I am lacking.
add a comment |
up vote
0
down vote
accepted
This might not be the correct answer, but so far in my case it matches and explains what I am seeing. I have not seen this information mentioned else where, but the answer is well upvoted, has been around for awhile, and is from a high reputation user, so I am inclined to trust it.
There is an answer from another question where they mention something important.
As to the why you need to worry about serialization, this is because most Java servlet containers like Tomcat require classes to implement Serializable whenever instances of those classes are been stored as an attribute of the HttpSession. That is because the HttpSession may need to be saved on the local disk file system or even transferred over network when the servlet container needs to shutdown/restart or is being placed in a cluster of servers wherein the session has to be synchronized.
The application Im working on DOES use Tomcat, so if this is a restriction or behavior, then I can easily see why all the POJO's are created in this fashion, simply to avoid issues that might develop later, and is a result of experience having worked with this all before, and its that experience that I am lacking.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
This might not be the correct answer, but so far in my case it matches and explains what I am seeing. I have not seen this information mentioned else where, but the answer is well upvoted, has been around for awhile, and is from a high reputation user, so I am inclined to trust it.
There is an answer from another question where they mention something important.
As to the why you need to worry about serialization, this is because most Java servlet containers like Tomcat require classes to implement Serializable whenever instances of those classes are been stored as an attribute of the HttpSession. That is because the HttpSession may need to be saved on the local disk file system or even transferred over network when the servlet container needs to shutdown/restart or is being placed in a cluster of servers wherein the session has to be synchronized.
The application Im working on DOES use Tomcat, so if this is a restriction or behavior, then I can easily see why all the POJO's are created in this fashion, simply to avoid issues that might develop later, and is a result of experience having worked with this all before, and its that experience that I am lacking.
This might not be the correct answer, but so far in my case it matches and explains what I am seeing. I have not seen this information mentioned else where, but the answer is well upvoted, has been around for awhile, and is from a high reputation user, so I am inclined to trust it.
There is an answer from another question where they mention something important.
As to the why you need to worry about serialization, this is because most Java servlet containers like Tomcat require classes to implement Serializable whenever instances of those classes are been stored as an attribute of the HttpSession. That is because the HttpSession may need to be saved on the local disk file system or even transferred over network when the servlet container needs to shutdown/restart or is being placed in a cluster of servers wherein the session has to be synchronized.
The application Im working on DOES use Tomcat, so if this is a restriction or behavior, then I can easily see why all the POJO's are created in this fashion, simply to avoid issues that might develop later, and is a result of experience having worked with this all before, and its that experience that I am lacking.
answered Nov 8 at 19:23
Fering
1288
1288
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194829%2fpojo-classes-being-serialized-with-no-read-write-usage%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Spring MVC end/or java web applications don't require serialization. I guess they wrote the code in that way in order to have all serializable object
– Angelo Immediata
Nov 7 at 17:41
@AngeloImmediata Is there a reason why they would want that? Some design principle, carry over from old practices, ...?
– Fering
Nov 7 at 17:54