vijay akni kumar

Greenhorn
+ Follow
since Aug 11, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by vijay akni kumar

I wrote a pojo class say it Employee.java

package org.emp;
public class Employee {

private String empid;

private String empName;

private String address;

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public String getEmpid() {
return empid;
}

public void setEmpid(String empid) {
this.empid = empid;
}

public String getEmpName() {
return empName;
}

public void setEmpName(String empName) {
this.empName = empName;
}
}

Now i want to generate hbm file for this pojo file.

how??? using Xdoclet?

Thanks in advance.....




Hi All
I have a hql query , when ever i iam getting 400 -500 records it is taking 3-4 sec. but when iam getting around 5000 record it is taking more time around 3 min in local system.

the method is
public List getAllSourcedCandiadtes(String startingDate, String endingDate) {

return (List) getHibernateTemplate().find(

"select distinct prospectiveCandidates from ProspectiveCandidates prospectiveCandidates where prospectiveCandidates.appliedDate between '" + startingDate + "' and '" + endingDate + "' and (prospectiveCandidates.sourceName != 'candidate' ) and (prospectiveCandidates.sourceResume !=null )");
}

the query is working fine but I want to improve the performance, even i tried using criteria API
Criteria crit = session.createCriteria(ProspectiveCandidates.class)
.add(Expression.between("appliedDate", new Date(startDate.getTime()),new Date(endDate.getTime())));

crit.add(Restrictions.and(Restrictions.ne("sourceName","candidate"), Restrictions.isNotNull("sourceResume")));

List abcd= crit.list();

return abcd;

I am able to get records with criteria API but iam not able to improve the performance.
please suggest me ................
I know that the existing record is same but i want to update the same record with particular fields that got changed. how to write the xdoclets in hibernate for updating the existing record.
I want to update the data using spring--hibernate. but iam getting error saying

[2008-22-26 03:22]DEBUG[http-80-Processor24](NewPooledConnection.java:363) - com.mchange.v2.c3p0.impl.NewPooledConnection@10da1d8 handling a throwable.
java.sql.BatchUpdateException: Duplicate entry 'ff8080811b775f70011b776d270b0001' for key 2
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)



[2008-22-26 03:22]DEBUG[http-80-Processor24](SqlUtils.java:85) - Attempted to convert SQLException to SQLException. Leaving it alone. [SQLState: 23000; errorCode: 1062]
java.sql.BatchUpdateException: Duplicate entry 'ff8080811b775f70011b776d270b0001' for key 2
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)



[2008-22-26 03:22]DEBUG[http-80-Processor24](DefaultConnectionTester.java:126) - Testing a Connection in response to an Exception:
java.sql.BatchUpdateException: Duplicate entry 'ff8080811b775f70011b776d270b0001' for key 2
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)




[2008-22-26 03:22]DEBUG[http-80-Processor24](JDBCExceptionReporter.java:63) - Could not execute JDBC batch update [insert into TDesiredPosition (authorizedToWork, employmentStatus, roles, jobTitle, desiredJobType, desiredLocation, relocate, desiredSalary_lacs, desiredSalary_thousands, usWorkStatus, user_id, notice_period, desiredId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]
java.sql.BatchUpdateException: Duplicate entry 'ff8080811b775f70011b776d270b0001' for key 2
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
In my application i need to upload excel file, whenever i upload using my local system it works fine but when i use server system and upload the file sometimes it load succesfully , sometimes it gives a eeror saying

javax.servlet.ServletException: Processing of multipart/form-data request failed. Read timed out
org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:202)....
....................

if i make changes in server.xml file saying disableUploadTimeout to false. will this effect the other application?

or if there is any other solution that you would like to share with me ?

tahnks
16 years ago
i need to display excel sheet values.

iam working on struts frame work.

the jsp page calls the action method

code:

input type="submit" tabindex="2" value="Registration.xls" ick="set('createMemberExcel');"/>



the action class contain method

public ActionForward createMemberExcel(ActionMapping m, ActionForm f, .........ponse) throws Exception{

{
retrieving data from databse

setting it to stream like this

byte[] blobdata1 = wb1.getBytes();
response.setContentType("application/vnd.ms-excel: xls, xlb: Microsoft Excel Document");
response.addHeader("Content-Disposition", "application; filename="+" MemberExcel"+".xls");
OutputStream out = response.getOutputStream();
int off = 0;
int l = (int) wb1.getBytes().length;
out.write(blobdata1, off, l);
out.flush();
out.close();
}
}


my code is working fine with mozilla browser but when iam using IE browser iam not getting file download manager. please give me your ideas to solve this problem. thanks
[ November 10, 2008: Message edited by: vijay akni kumar ]
16 years ago
i have a jsp for which i have to encrypt and send information to paypal site. and it should take some dynamic values such as amount.

my code in jsp is.


form action="https://www.paypal.com/cgi-bin/webscr" method="post"
input type="hidden" name="cmd" value="_xclick"
input type="hidden" name="image_url" value="http://ABCDcom/images/Board40.gif"
input type="hidden" name="business" value="[email protected]"
input type="hidden" name="return" value="http://localhost:8080/ABCD/"
input type="hidden" name="item_name" value="Abcd web site"
input type="hidden" name="item_number" value="10098"
input type="hidden" name="amount" value='<%=pform.getTotal() %>'
input type="hidden" name="no_shipping" value="1"
input type="hidden" name="cancel_return" value="http://localhost:8080/ABCD/"
input type="hidden" name="no_note" value="1"
/form

here pform.getTotal is the dynamic amount. which should encrypt always.
please send me steps to how to encrypt
thanks in advance
16 years ago
In my application when ever i download a file i get a download manager if i say save it works fine but when ever i click on open it gives error message.
my code for download is

String fileName = rst.getString("filename");

response.setHeader("Content-Disposition","attachment; filename=\"" + fileName);
response.setDateHeader("max-age", 0);
response.setHeader("cache-control", "no-cache");
response.setHeader("Transfer-Encoding", "chunked");
response.setHeader("Transfer-Encoding", "deflate");response.setHeader("Content-Encoding", "en-US");
response.setHeader("Connection", "keep-alive");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "no-cache");
OutputStream out = response.getOutputStream();
int off = 0;
int l = (int) rst.getBlob("docunemt").length();
out.write(blobdata, off, l);
out.flush();
out.close();
can any one tell me how to solve this problem is here any problem with headers that iam setting.
16 years ago
I have a jsp page in which

html
head
body
Address Details
input type="submit" on Click="window.print()" value="Print"
table border="1"
<tr>
<th>abcd</th><th>abcd</th><th>City</th><th>State</th><th>Zip</th>
</tr>


jsp:include page="footer.html" />[/CODE]


I need to print only the Address Details ie table only.

can any one suggest how to do this.

Thanks
I got ajsp with two button which calls struts action class methods(ShowEntries).

In struts action class i got a method called
ShowEntries(ActionMapping................){

return mapping.findForward("xxxxx");
}


In Jsp, when First button is clicked it needs to displays information in display tags and second button needs to display data in Html page. but Both are pointed to ShowEntries method of Action classes. we have only one forward for one action. without repetition of code how can i access. or is there any way to keep to two return find.forwards.
16 years ago
In struts we place key and value information in properties file for displaying message.

in java page

ActionMessage msg = new ActionMessage("errorupload.empty");
exMsg.add("message1", msg);
saveErrors(request, exMsg);
return mapping.findForward("entersheet");

in application.properties
errorupload.empty=please enter valid sheet.

whenever any thing goes wrong i get the message please enter valid sheet.
I want to add dynamic information to these messages. like it should take some value from java page and display dynamically that information along with message.


thanks
16 years ago
i need to display excel sheet values. i am getting illegalstateexception.

iam working on struts frame work.

the jsp page calls the action method


the action class contain method

public ActionForward createMemberExcel(ActionMapping m, ActionForm f, .........ponse) throws Exception{


{
retrieving data from databse

setting it to stream like this

byte[] blobdata1 = wb1.getBytes();
response.setContentType("application/vnd.ms-excel: xls, xlb: Microsoft Excel Document");
response.addHeader("Content-Disposition", "application; filename="+" MemberExcel"+".xls");
OutputStream out = response.getOutputStream();
int off = 0;
int l = (int) wb1.getBytes().length;
out.write(blobdata1, off, l);
out.flush();
out.close();
}
}


my code is working fine with mozilla browser but when iam using IE browser iam not getting file download manager. please give me your ideas to solve this problem. thanks
[ November 10, 2008: Message edited by: vijay akni kumar ]
16 years ago