Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Dhiraj Srivastava

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

Recent posts by Dhiraj Srivastava

Hi,

Following are some of my issues while setting up Tomcat and Eclipse. Please note my application is working file.

1. Getting following errors while starting up Tomcat

org.xml.sax.SAXParseException: Elements "struts-config" allows no further input; "message-resources" is not allowd.

This is my entry in strtus-config file. I have added this file in classes folder under com.resources package.
<message-resources parameter="com.resources.ApplicationResources"/>

2. Following are the jars which I have added under my /lib folder and added in my .classpath file

<classpathentry kind="lib" path="WEB-INF/lib/antlr-2.7.2.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-chain-1.1.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-digester-1.8.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-fileupload-1.1.1.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-io-1.1.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/commons-validator-1.3.1.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/jstl-1.0.6.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/oro-2.0.8.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/standard-1.0.6.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/struts-core-1.3.8.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/struts-extras-1.3.8.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/struts-taglib-1.3.8.jar"/>

Is it fine to add this way as there is no struts.jar file.

Waiting for response.

Thanks in advacne.

Dhiraj Srivastava
SCJP
10 years ago
Hi,

Still I have major issue.

Consider Following Recrods

Id Amount
1 400
2 500
3 500
3 250
3 -

As In this table I don't have any unique combination. Even in composite key. Now I want all the records as it is.

Now if I put Id Column as primary key it will give:

Id Amount
1 400
2 500
3 500
3 500
3 500

500 will repeat in all the Id 3 records. And If put both of these coloumns in the <composite-id> tag I get the following records.

Id Amount
1 400
2 500
3 500
3 250

Now you can see last record is not coming. Becase Amount Value was null.

All I want the exact records in my Hibernate Query. As I get from SQL

I hope I am able to explain the problem clearly.

Regards,

Dhiraj Srivastava
Hi...

Thanks.. Its working..

Regards,

Dhiraj..
Actually I fetching recrods from a View. I cannot use unique key here. Is this problem relates something with cache.

Thanks

Dhiraj Srivastava
Hi,

I am getting following recrods from DB

Id Amount
1 400
2 0
3 500
3 250
3 1000

I want exact record in my Hibernate Query. But I Get

Id Amount
1 400
2 0
3 500
3 500
3 500

Value against the same Id (300) repeats every time. WHY ???

Thanks in advance
Dhiraj Srivastava
[ August 08, 2007: Message edited by: Mark Spritzler ]
Hi,

Here this query gives location of first occurance of letter 'A' in the name.

select
(posstr(t1.NAME,'A')) as Location, t1.Name from vista.VFZPVACCOUNTANT t1


------------ OUTPUT ------------------

LOCATION NAME
----------- --------------------------
0 test
14 Kuhn Handels AG

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

I want to select only "Non Zero" location records. Means There should be atleast one 'A' or 'a' in the name.

So that in the output there should be only second record.

I am working on Db2 database Can ne one help.

Thanks in advance,
Dhiraj Srivastava
Hi,

To be specific following query is not working. I just want to know how can i use a inner query which is aliased with AS.


SELECT A.tfzRequestId, A.tfzDecisionId FROM FzDecisionDE A,"
+ " (SELECT B.tfzRequestId FROM FzDecisionDE B) AS X"
+ " where A.tfzRequestId = X.tfzRequestId"


We add this query in a String Buffer then we pass this buffer as String in the following method.

HibernateTemplate template = getHibernateTemplate();
list = template.find(pQueryString, pValues);


Thanks

Dhiraj Srivastava
Hi,

I am putting this query in a String Buffer then pass it to hibernate. As i wrote this query is working perfectly in database but not from the java code.

thanks,

Dhiraj
Hi,

Please see the following query. When I execute this from Code it gives me

SEVERE: *** ERROR: line 1:491: unexpected token: (
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:562: unexpected token: (
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:588: unexpected token: max
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:609: unexpected token: AS


Although this query works perfectly in DB2. Please Note Brackets and syntax is perfectly correct as it works in database.

Its urgent kindly look into the matter.

-------------------------- Query -----------------------------------------
+ "SELECT DISTINCT t1.tfzRequestId"
+ " FROM"
+ " FzRequestAllowanceViewDE AS t1,"
+ " ("
+ " SELECT A.tfzDecisionId"
+ " FROM FzDecisionDE A,"
+ " ("
+ " SELECT B.tfzRequestId , max (B.decisionDate) AS MAXDECISIONDATE FROM FzDecisionDE B"
+ " WHERE B.bisFinalized = 'T'"
+ " AND B.decisionDate <= '2008-12-31 00:00:00.000000'"
+ " GROUP BY B.tfzRequestId" + " ) AS x"
+ " WHERE A.tfzRequestId = x.tfzRequestId"
//+ " AND A.decisionDate = X.MAXDECISIONDATE"
+ " AND A.bisFinalized = 'T'"
+ " GROUP BY A.tfzRequestId, A.tfzDecisionId" + " ) AS t2");

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

Thanks

Dhiraj
Hi,

My table test has three columns

id partner_idDate
11025/10/1968
21025/10/1992
32015/11/1968
42015/11/1969
52015/11/1975
63022/12/1994
73023/10/1968
84025/10/1968


I want distinct record on the basis of partner id whose date is maximum

The result should be ::

id partner_idDate

21025/10/1992
52015/11/1975
63022/12/1994
84025/10/1968

Thanks in advance...

Dhiraj
Hi,

In my application I want only one user to access a particular section at a time. The scenario is suppose I log in the application to change a customer address based on customerId. At the same time login in the application with the same customerId. Then other user see "A person is already working on this id".

However, I have solved this problem by using ServletConext Object.

----------------------------------------------
ServletContext sc = getServlet().getServletContext();
String sValid = "0";
if (sc.getAttribute("CurrentId_"+customerId)!= null)
sValid = 1;
else
sc.setAttribute("CurrentId_"+customerId,"1");

if (sValid.equals("1"))
<EXCEPTION THROWN THAT SOME USER IS WORKING>
----------------------------------------------

First time the case will be in else block. Second time system throws exception.

Now my concern is this how can I put this attribute to null. So that new user will be able to work.

I hope you people will understand.

Thanks in advance,

Dhiraj Srivastava
11 years ago
Hi,

Thanks I got the solution.. Its easy to wrap the FileWriter Stream into the PrintWriter..
Following is the code..
------------------------
FileWriter fw = new FileWriter(<FILE NAME> ;
PrintWriter pw = new PrintWriter(fw);

pw.println();

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

Anyways..

Thanks for help...


----------------------------
Success is not a 100 meter race its like a marathon where you have to show your persistence and courage little longer.
12 years ago
Hi,
I want to insert a new line in a text file which I generate from my code.
Following is the code snippet. Please see the output below. Why spaces are also coming between every character

/*****/

import java.io.*;

public class LetterGeneration
{
public static void main(String[] args)
{
try
{
DataOutputStream fout = new DataOutputStream(new BufferedOutputStream (new FileOutputStream("Lines.Txt")));
fout.writeChars("This is first line");
fout.writeChars("This is second line");
fout.close();
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception occured..");
}

}
}

/*****/
Output : Lines.Txt
T h i s i s f i r s t l i n e T h i s i s s e c o n d l i n e
/******/

I want like this..
This is first line
This is second line


Thanks in advance..
Dhiraj
12 years ago
Hi,

In one of my code enhancement project I am getting data from a stored XML and display in a JSP. However I want that XML dynamically updates from a particular website. Is it possible??

Further, I want to develop a data capture form. Upon entering data into that form I want to generate a XML file.

How can I do this??

Thanks in advance