Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

g venkata

+ Follow
since Dec 29, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by g venkata

Nice Thread...

He can mark the caller method as synchronized to make


thread safe.

Venkat Ram
Welcome Mala

All the Best!

Welcome to JavaRanch Deepak..
All the best
5 years ago

2. Best practice is to use whatever is clearest - personally I use public variables unless the JavaBeans API is involved

Thank you bill for your suggestions..
But, i am using bean type setter and getter methods. like JavaBeans API
Shall I create a String variable for it.. and use it whereever requried?.
If so, I need to create 20 string variables like that.
or shall I call getter methods for all of them.
which would be better?

Please suggest
7 years ago
I have three doubts in perofrmance fix

1. Is better to use Switch case (using enums for string) or if else .. if the options are exceeding 50.
2. There is a POJO class. am calling obj.getxxx() method several times in other class instead of creating a variable for it.
Is it a better practice or creating a variable and using it is better?
3. This is regarding JDBC and JSP using Oracle10g,Tomcat and JBOSS.Currently this is the scenario. I am retreiving more than 1000 records in resultset. But actually the user requires 10 records..rarely he requires 1000 records. Am iterating thru a loop in DAO class and getting that particular records in while(resultset,next()) and passing them to JSP (thru request obect)
If the user again requests for 20 again doing the same.
Because of this the query is executing again and again. and the server is becoming very slow.
(The code written long back and also not upto the standards and performance is not considered while developing)
But Now, i want to change it like..
1.Keepiing the resultset in a map and want to store in sessionObject. whenever the user again wants 10,20, 30 or all the records , i wil get them from session and wants to display in jsp.
2.Using rowid concept in query itself while retreiving the records.
Which one is better? or is there any otherways of doing it

Please help and correct me..

7 years ago