tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jay Hulslander <>
Subject Re: Nervous about Sessions ...
Date Wed, 27 Apr 2005 15:50:52 GMT
To store a Java Object in session (HTTPRequest or HTTPResponse), just make 
any Object (POJO or something more complicated) implement 
serializable.  Keep in mind, you don't need to code an extra functions, 
just add the implements serializable to Class definition.
At 07:42 AM 4/27/2005 -0400, you wrote:
>If I use the "session" to store things, 1. Can I use simple java types? 2. 
>Do I have to use Java Beans (extends serializable)?
>David Whitehurst
>Viorel Dragomir wrote:
>>But you can set some attributes of the objects as [ transient ] to not be 
>>serialized. So you don't have to make all objects in the package serializable.
>>Viorel Dragomir
>>----- Original Message ----- From: David Whitehurst To: 
>> Sent: Wednesday, April 27, 2005 11:31
>>Subject: Nervous about Sessions ...
>>Long ago a multi-client, multi-Oracle application was written using 
>>Struts.  Recently, we had a 4 in 22,000 record data integrity issue.  I 
>>found one client implementation that used prepared statements but the 
>>primary key was being used e.g. "update mytable set a= ?, b=? where 
>>pri_key = " + pkey + " ' "; ...whoa! I said, called the developer and we 
>>had a talk.
>>Then, I also found that where we use a HashMap object it is not 
>>synchronized.  I suspect that was the data problem, i.e. two records 
>>saved by two different people, and the data was the same for the 
>>different records in the same Oracle second.
>>I'm looking for comments about the use of this HashMap on "requests" but 
>>I'm also nervous now where I use Strings in the "session" e.g. a 
>>clientname, username, etc. My concern started when I read the posts about 
>>the non-serializable objects in the session.  Do all java objects placed 
>>in the session have to be serializable?
>>David L. Whitehurst
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message