Ravikiran Vishnuvajhala

Ranch Hand
+ Follow
since Jan 11, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ravikiran Vishnuvajhala

Originally posted by Geoff Hambrick:
While the book evaluates some specific technologies (JDBC, iBatis, Hibernate Core, Open JPA and PureQuery), it is intended to help various roles ask and understand the answers to questions of interest to them. For example, executives are going to know what the costs and benefits of a fraemwork are in terms of business drivers such as availability of skills, standards adherence, etc.



Geoff,

One more question to this is - does it also list down the pros and cons of these frameworks, for example: performane, scalability, rapid application development, flexibility and maintainability etc?

Originally posted by Elizabeth King:
Like all the Set in Java collection, ResultSet is a little bit mess. I also feel that it is cumbersome to retrieve data from ResultSet, but it is a straight programming and is certainly not very difficult for most Java developers.

Introducing new frameworks on top of JDBC presents a much bigger challenge to the Java community because of the new architectures, new APIs, new configuration, new tricks, and new bugs. Although some of the frameworks look elegant, most of them do not have real new substances. The new frameworks disturb the developers� focus on the enterprises� business needs and increase the cost of development and maintenance because of lack of developers who know all the frameworks.

Java is losing the war to the MS partly because of the various open source frameworks. Sun is falling and powerless to stop something similar to Visual J++ anymore.

I know you may not agree with me.

[ April 19, 2008: Message edited by: Elizabeth King ]



I can also argue that instead of learning JDBC, I can directly learn ORM tools to perform the operations required to be supported on a persistance store as opposed to learning both. That way the learning curve would remain the same. I don't think learning this additional tool is a big deal.

One thing we need to accept is that programming evolves with time. And we need to be adaptive to that. Every aspect of application development has tools that we can use to write and build our applications.

Thanks
Ravi
I have also found this interesting article on the advantages of using Groovy for JUnits -

http://www.javalobby.org/java/forums/t94245.html
16 years ago
Please ignore my question.
[ June 12, 2007: Message edited by: Ravikiran Vishnuvajhala ]
Marcus,

I am a bit confused about your question #1. Are you saying that we should throw an error if the input array size is smaller/larger the number of fields in the database?

I am not sure if it is true for the find method. What if I want to search for only one field in the database which is the fourth column in the database. Can I not create an array of size 4 elements and pass it to the find method and keep the values for the first three elements null?

What do others think?

Thanks
Ravi
I feel in this case, we can go with the solution that Andrew defined in his book i.e using something like the ReservationManager to maintain the log of owners of locks using the Database instances.

Andrew,

If we go with the similar solution as your ReservationManager, won't there be a problem when multiple threads (not using RMI or sockets or Swing, but using plain java classes) access the lock/unlock methods of a single Data class's instance? Or do you think we can safely assume that each thread should create a separate instance of the Data class based on this statement -

"You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server."

I think this problem will not arise from the remote server as we are creating a separate instance for each client.

Thanks
Ravi
After thinking more about it and from what you people mentioned, I also now think what you people are saying does make sense. This field cannot be manipulated in any way other than users directly accessing the Data Class to enter some useless data. Then, I guess it is their problem.

Thanks a lot for your suggestions and inputs.

Thanks
Ravi
Well, if someone is calling the create,update methods directly on the Data class, they can send garbage like "$abc.123", "$123.abc" or "$123,abc" right. Don't we need to prevent that?
Hi,

I have a field that contains the currency symbol and the amount for the room. The following is the instruction statement from SUN -


I am debating about the following points regarding the validation of currency on the "rate" field. Please execuse me if some of them are pretty basic questions -

1. How many bytes should I allocate for the currency symbol? Can I assume one byte?
2. How will I validate the float/double value after the symbol? Also, can the symbol be the last character in the field value?

3. Depending on the currency, it could have a "." or a "," as the decimal symbol.
4. How many digits can be present after the decimal?

Do you think there is a easy way to validate these or I leaning towards not doing the validation at all and just document it that when data class is directly invoked, users need to enter a valid value?

Or can I make some choices here like - one byte for currency and digits after decimals can be only two and the decimal separtor symbol can be only "." and that the currency symbol should be at the beginning of the field?

Or if there is a way to validate all these, please do let me know.

Thanks
Ravi

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]
[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]
Hi All,

Thank you for your replies. I definitely think that we should synchronize the file object during instantiation and initialization of record numbers and column related information, because we want to make sure that no other thread is already modifying the data while the "nth" is still reading the data from the file.

Also, if I understand threading correctly, when a thread tries to access a object that is already locked by another thread, it is blocked and does NOT use any CPU cycles. So, I don't think I am violating this rule on the instructions.html -

"Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available."

But, please do let me know if you think otherwise.

I chose to use private static variables just like the one mentioned in Andrew's SCJD book. I guess the other way to do it is make the class that accesses the database file a singleton.

Thanks
Ravi
Hi,

I have the following question regarding synchronization inside the constructor of the class that accesses the data file -

I am planning to synchronize on an object as the first thing in the constructor that takes the data file name and path as input (I have made the default constructor private). The following is the logic I am using -



I am planning to read the header first and record numbers dynamically and store them intially and then allow any modifications to the file.

My question is - is it fine to synchronize the entire block of code that reads and stores the data in static variables (HashMap, Arrays)? Do you see any issues in this case? Another approach is to synchronize the block that is populating the variables (HashMap, Arrays), but I feel that it might lead to some issues like if one thread has already started modifying the data file, then other threads still trying to get the instance of DBAccess might corrupt these static variables in the class.

The instructions say that -

"Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available."

I don't think the above logic is violating this rule, but can you please let me know if my theory is correct or not? Or do you have any other suggestions?

Please help!. I searched the threads for this specific case and could not find anything. If it is already answered, please forward me the link.

Thanks
Ravi
[ March 20, 2007: Message edited by: Ravikiran Vishnuvajhala ]
Well, regarding your #1, if you go the route of raising exception only when the create is called with a record number that already exists, there will never be a case because the signature of the method only takes String[] as input (I am assuming you are not forcing users to specify record number also as an element in this Array). I am not taking a functional scenario here like URLyBird in this case. I just gave an example of how to achieve uniqueness when no key is given to you. I think it is purely up to us to design and document as to whether we allow such a creation or not. As long as it is documented, I think either approach should be fine.

For #2, it is your choice again. How will you support a scenario where someone genuinely wants to nullify certain fields?
I guess the answer to the first part of your question is to question whether can we have two exact same records with just different record numbers? If we want add this restriction, then I would think that we should validate mainly to see if records have exact same values (may be concatenate all the strings and compare them). Ultimately, I think it all depends on your design.

Regarding your second question, I think this is definitely what you are going to assume and document. If we do not allow nulls for certain fields, then we should document it.

- Ravi
(Working SCJD URLyBird 1.3.3)
Thanks a lot Tim for your confirmation.
[ March 13, 2007: Message edited by: Ravikiran Vishnuvajhala ]
Hi,

I have the following questions on the Data File provided and the instructions given:

1. The instructions say:
"All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes".

I am assuming here it is just for our information and not really meant to read the data using the DataInputStream Class. I am planning to use RandomFileAccess class to read the file. Please let me know if my understanding is not correct

2. Magic Cookie Value:
Is it ok to store the Magic cookie value in some properties file and use it to validate the value stored in the data file to match file. Or is there any other suggested way to validate this value? Or do you think we don't need to worry about it?

Thank you for your help.

Thanks
Ravi