Ritika Saxena

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

Recent posts by Ritika Saxena

Recently I have been asked a question: which design pattern is implemented by SAX parser. I think it could be Factory pattern.
Can anyone give me some idea about this?

Thanks in advance.
What does "Design by Contract" mean in Java?
Hi kay jee

Can you please elaborate a bit more on what you want. Your requirement is not clear to me....
18 years ago
Mark, thanks for your reply.

I have read some where that the batch size could be anything between 10 and 50. But I wonder, what would be the impact if we make the batch size as 150 or 200. Do you have any idea about this?

Thanks once again!!!
Hi,

We need to insert a large number of records in the database. In order to enhance performance, we are performing bacth insert as:
----------------------------
1. Setting the batch size to reasonable number:
hibernate.jdbc.batch_size 20

2. The code is modified as:
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
for ( int i=0; i<100000; i++ ) {
Customer customer = new Customer(.....);
session.save(customer);
if ( i % 20 == 0 ) { //20, same as the JDBC batch size
//flush a batch of inserts and release memory:
session.flush();
session.clear();
}
}
tx.commit();
session.close();
---------------------------

But can any one please tell how should we determine the optimum batch size (as mentioned in Step 1.) We have to insert approx 50 lakhs records in the table.

Thanks in advance!!
Hi,

I have two tables in my Oracle database as: ONHOLD and VALID.

In my application, the entire data from ONHOLD table is selected, then some conditions are checked on all records and the rows/records which meet those conditions are saved in VALID table. The other records which do meet the condition, remain in ONHOLD table.

My problem is that the ONHOLD table has more than 10 lakh records. So the entire process takes a lot of memory. How can I make sure that data from ONHOLD table is selected in small chunks?

I cannot select the data on the basis of ROWCOUNT or ROWNUM as it results in checking some records more than once. Like, if I select first 100 records from ONHOLD table out of which 40 are validated, then these 40 records move to VALID table and the 60 invalid records remain in ONHOLD table. Now if I again select 100 records and check them, the 60 records which had already been checked in first step are checked again.

Can anyone suggest me some way to solve this problem?
Thanks in advance!!
18 years ago
Hi,

I have created a Java project in Eclipse. Till yesterday, I was able to compile the classes which I create. But today, none of my classes are getting compiled. I haven't changed any of my eclipse or project settings.

Can anyone please help me in identifying the problem.

Thanks in advance!
Hi Merrill, thanks for your reply.

I can very well use more than one resource bundles in jsp using the way you mentioned. But is there any way by which I can let my action form know as to which resource bundle is used for this form.

Thanks,
Ruchi
18 years ago
Hi,

I am running a very basic program using eclipse. When I click on run, the program runs fine but doesnot show any output on the console.

Here is my program:

package com.test;

public class OALTest {

public static void main(String[] args) {
System.out.println("Testing the OAL Class");
}
}

I am completely clueless as to what can be the problem in this case???
18 years ago
Hi,

I am developing a Struts application with two properties file(ApplicationResources.properties and ErrorMessages.properties). Now I am validating form data through ActionForm's validate method as:

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if(id == null || id == "" || id.length() == 0) {
errors.add("userid", new ActionError("login.userid.error"));
}
if(password == null || password == "" || password.length() == 0) {
errors.add("password", new ActionError("login.password.error"));
}
return errors;
}

If there is only one properties file i.e ApplicationResources.properties; the application is working fine. But if I distribute the key-value pairs in two files, it gives an exception.

How can I solve this problem?

Thanks,
Ruchi
18 years ago
Hi,
I have already included these jars: jstl.jar and standard.jar but this error is still present.
18 years ago
JSP
Hi,
I have created a web project and running it using Tomcat 5.5
I am trying to use JSTL in my jsp.On writing the taglib directive in jsp, it gives me the following error:
------------
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)..........

-------------

Do I need to make some changes in web.xml also in order to use the tag library?
18 years ago
JSP
If we compare the Redirect and Forward mechanism, we find that:
1. In Forward, the client does not come to know that the request is being directed to a different address while in Redirect, the client knows that.
2. While using Forward, the request attributes are available to the new request while in Redirect it is not so.
3. Forward is faster as compared to Redirect.

Looking into these points, it is pretty clear that Forward is better than Redirect. I have read that at some places, it is preferred to use Redirect but I could not figure out the reason for that.

Can anyone please give me any practical situation where Redirect is preferred over Forward.

Thanks in advance.
18 years ago
What are Strong references and weak references with respect to Garbage Collection?
18 years ago