Kunal Lakhani

Ranch Hand
+ Follow
since Jun 05, 2010
Merit badge: grant badges
For More
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 Kunal Lakhani

Thanks for your replies members
I dont want gaps in my ids.


Not understood this concept.

I need to get the max id and the next id before saving anything in the database

Should i go for locking and unlocking ?
Let me explain the complete thing.

There are 2 columns in my db, one is ID (generator type is increment, via hibernate), and the other is Registration id. I am getting the max id, then getting the registration id for that max id, then adding 1 to that registration id to get the new registration Id.... Moreover, i need to get this new registration id before saving it to the database.

Bear Bibeault, delighted to see your reply as i am here in this forum after a very long time.
Sequence in mysql? I guess its implemented by AUTO_INCREMENT. how will it solve the generation of next id?

Thanks for your replies

Arun Giridhar, I have tried last_insert_id() , but, it works just after an insert, i guess. I have posted its working too.

I found out

LAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value representing the first automatically generated value that was set for an AUTO_INCREMENT column by the most recently executed INSERT statement to affect such a column.

Claude Moore, Thanks, googling it. Someone suggested for a lock before saving, but that would not be good one i guess.

I found this problem interesting one, did a lot of googling, but, couldn't find any solution. Lets learn something new then.
I am not sure as if i am posting the query in right forum

I am working on a web application. It will have multiple users. I am using mysql as database.

In my application i am fetching the latest id (from the database, using max(id)) , and then generating the next id for the new registration. This approach is incorrect, as the id might change between the time i update an id
and i ask for the latest id. I googled up , and found "last_insert_id()"

But, i tried "SELECT last_insert_id() FROM `rdtype` ", but its gives the same number of 0 as the no of records.

How should i proceed?
I am working on a web-app where i am using Jasper report asreporting tool, with servlet-jsp, and hibernate

It shows the following exception on opening the jsp page, and on refreshing the jsp frequently, the exception disappears and it works


SEVERE: Servlet.service() for servlet jsp threw exception
java.io.IOException: tmpFile.renameTo(classFile) failed
at org.apache.jasper.compiler.SmapUtil$SDEInstaller.install(SmapUtil.java:246)
at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:165)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:458)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)


org.apache.jasper.JasperException: Unable to compile class for JSP
root cause

java.io.IOException: tmpFile.renameTo(classFile) failed
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.39 logs.

Did a lot of googling, but couldn't find a suitable solution

Also checked the permission, only special permission for the user is unchecked

I have been using tomcat with hibernate jasper report since last 1.5yrs and its the first time i am facing such problem
10 years ago
Thanks to all of you members.

I am using Servlet jsp as i dont have enough time to dive in with spring.
May be, later on, i may use spring in a no time-constraint project
10 years ago
Thanks for your reply Jeanne Boyarsky
Frankly speaking, last time i had worked with spring was about 1.5yrs back.

So, i think it would be better to use jsp servlet
10 years ago
Thanks Ulf

Thanks for your valuable suggestion. Started reading securityfaq
10 years ago
Hello Members

I am working on a web project for a finance company whose functions would be similar to those of banks. i will be using mysql as the database, with hibernate as the orm framework. Will also use SSL. Should i go for simple Servlet & Jsp or Spring framework? (I am having only 45 days to hand over the project)

Please give your suggestions with reasons to support it

10 years ago
Hello Members

I am working on a web project for a finance company whose functions would be similar to those of banks. So, i am concerned about the security.
This would be my first project where main concerned would be security as the app would be hosted in the server.
I think i need to go for SSL, that's for sure. Please give your suggestions as per security.

10 years ago
I am very weak in DB Designing and dbms concepts like cardinality , normalization, etc. How can i improve? Also going through some of the books, but still, i am having problems.

Any site/link/book that can help me and treat me as a beginner?

10 years ago
Members, Please reply. Did a bit of googling, but, couldn't find a solution.
11 years ago
I am using ireport4.6 for report generating. The title is in 'monotype corsiva' font. It works fine, when i click preview in the ireport tool. The pdf generated contains all as expected. But when i am calling this jasper file from my servlet, the report is generated (though in another tab as coded) but, the title font is simple, i think the default one.

How should i proceed?
11 years ago
I need to check for the value of Editbox22,Editbox26...on the difference of 4 till they exists

Assuming there is no id with '#Editbox24xxx', then while loop body won't be invoked?