Pradeeep Sharma

Ranch Hand
+ Follow
since Dec 04, 2008
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 Pradeeep Sharma

Hi,
I got this error when i searched in bunkhouse for book.

500 Error in Javaranch

A customized error page should be there for 500 error.

With Regards,
Pradeep Sharma
12 years ago
yes!
But when i run the same query in simple java file it runs fine, and in jsp code it's creating problem. I mean i not getting any record.
Hi,
First Merry Christmas to all!

I am new to hibernate i am facing problem in implementing HQL for select query. Below is my hbm file:


and the related HQL for this in POJO class


but when I try to run this i got error message like this:

Hibernate: select register0_.FIRSTNAME as col_0_0_, register0_.LASTNAME as col_1_0_, register0_.EMAIL as col_2_0_ from CONTACT register0_
java.lang.String


As the name has changed in query i am not able to get any record from database.
Can any one tell me what s the actual solution for this problem.

With Regards,
Pradeep Sharma
Hi,

First i am showing my code

This is the code to prevent any shell from being closed. But when i close a Shell object it gives me an error

shell has already closed



because of this i got exception. can anyone tell me what is the solution of this problem.


With Regards,
Pradeep Sharma
12 years ago
This was the real answer i was waiting for. This is really helpful, Thanks for the help.
12 years ago
Please give attention at this


can any one tell me some rules of casting

12 years ago
Alright i got it, the use of interfaces. But my problem is still as it was. So can any one tell me some rules of casting. So that i can relate my problem with any of them and find a solution.
12 years ago
I did

as you said

Declare your objects as both being of the type of that interface, then there is no need for casting.




Now to access any method for example table.isFile() ,this method should be declared in interface as well as in both the classes. Now the question is that if i would have all the common method in both the classes, then there is no need for declaring any Interface.
12 years ago

Pradeep, you will need to have a mapping from FtpFile to TableFileItem somehow.



Can you tell me how??
12 years ago
I want to say that


with obj1 you will not be able to access the members of Person class.

Also please have a look at this too

To sort this problem i made a interface and implemented in both the classes, still i am not able to cast them. Can you tell another sort of problem.


12 years ago
Thankx Himanshu ,

Your solution is not working.


As the code shown above you are assigning Person and Addr into Object class. By doing so person and addr lost their original identity and they became object of Object class only.So now there is neither Person nor Addr remained only Object is there.

According to Campbell Ritchie

If they are unrelated, you can't cast them.

.

To sort this problem i made a interface and implemented in both the classes, still i am not able to cast them. Can you tell another sort of problem.
12 years ago
Hi,


I have two classes one is TableFileItem and other is FtpFile. There is no relation in between them, in a third class FtpBrowserEngine there is a method named deleteRecursive(TableFileItem). This method takes argument of TableFileItem type and checks whether it is a file or a directory.If it is a file then methode deletes it, if it is a directory then this method has to call itself. This should be done in a recursive way. But the problem is that method inside deleteRecursive(TableFileItem) method returns a FtpFile object, and to call deleteRecursive(TableFileItem) i need to cast FTPFile object into TableFileItme. Can anyone tell me how can i cast FTPFile in to TableFileItem.


12 years ago
Thanks for this. But this code is useful for single computer i need to delete a directory on remote computer through FTP command.
Here is the code listing i am using to delete a directory


public boolean deleteDirectory(String directory) throws IOException {
if (directory == null)
throw new IllegalArgumentException("argument can not be null");
return connect.sendCmd("RMD " + directory).startsWith(FILE_OPERATION_OK);

}


Where connect is the object of FTPConnection class whose sendCmd method is:


public String sendCmd(String cmd) throws IOException {

if (!isLogin)
return null;
if (cmd.startsWith("LIST") || cmd.startsWith("RETR")
|| cmd.startsWith("APPE") || cmd.startsWith("STOR") || cmd.startsWith("RMD"))
if (isPasv){
datsocket.setActiveSocket();
}
else{
datsocket.setActiveSocket();
}
return ctlsocket.sendCmd(cmd);
}


Again it's call a sendCmd method of FTPControlSocket class which has following code:


protected String sendCmd(String cmd) throws IOException {
String tmp= cmd+"\r\n";

if(isDebug)
debug.log(cmd,Logger.COMMAND);

writer.write(tmp.getBytes(connection.getCharset()));
writer.flush();
return getResponse();
}


can you help me out now.

With Regards,
Pradeep Sharma
12 years ago