Ali Ekber

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

Recent posts by Ali Ekber

I am working on an HQL hibernate query and a simplified version of the code is below:

List messages = new ArrayList();
Session session = getSession(false);
String hqlSelect = "select id, messageText, uId from Message where uId = :userId";
Query query = session.createQuery(hqlSelect);
query.setString("userId", userId);
messages = query.list();

Iterator it = messages.iterator();
while (it.hasNext()) {
System.out.println("message -> "+ ( ((Message) ((ArrayList) it.next()).get(0)).getMessageText()));
}

I am getting ClassCast exception inside the while loop when I try to type cast the iterator to ArrayList or to Message. I think iterator is coming back as Object.

Is there any way I have the result set (List) returned as an array list of Message classes?
Here is error message when I run my code:
[IBM][CLI Driver][DB2/AIX64] SQL0418N A statement contains a use of a parameter marker that is not valid. SQLSTATE=42610

Unfortunately, I don't have the luxury to upper case it before I send in the search criteria.
I need to upper a search criteria in the WHERE clause in a prepared statement. It is something like this:

... WHERE name=UPPER(?);

But it doesn't work. Is it possible to do UPPER in prepared statement, with a different syntax? Thx.
I need to upper a search criteria in the WHERE clause in a prepared statement. It is something like this:

... WHERE name=UPPER(?);

But it doesn't work. Is it possible to do UPPER in prepared statement, with a different syntax? Thx.
Say I have a servlet called TestServlet in package com.abc.servlet. If this servlet is not defined in web.xml, how do I access it on the browser? I tried http://localhost/com.abc.servlet.TestServlet, but didn't work. Thx.
18 years ago
Can someone explain the point of declaring an interface with no member and no method declarations? Serializable is an example of this typs of interface. I think it is done for OOP purposes, but cannot figure out why? Thanks.
18 years ago
Is it possible to calculate the number of work days, say between Apr. 15, 2006 and Jan 20, 2007? I can calulate the number of days, but need Monday-Friday number of days (work days with no holidays)? Thanks.
18 years ago
Can someone give a brief reasoning why we would one over another? I know there is a forEach in JSLT and logic:iterate in Struts which are compariable, but when to use one over another. Thanks.
18 years ago
I am running Tomcat 5.5 on Linux, and it started acting very wierd. I have a commented out piece of Java code somewhere in my JSP, and I am getting an error.

The actual error is an SQL exception, but the code is commented out, so it shouldn't be executed. This is very strange. Any ideas?
18 years ago
I need to set-up few virtual hosts on Tomcat5.5. Anybody knows any resources that show how to do this? I have done this on Tomcat4.1, but it seems like 5.5 has a different set up. Thanks.
18 years ago
Amy, what are rowid and rownum? Are they keywords in SQL server? I am getting syntax error for them.
I need to limit the result set coming from a SQL Server query. I can get the top 10 by SELECT TOP 10. But how do I get the rows from 11 to 20, for example? This is very easy in MySQL, but don't know the syntax for SQL server. Is this possible without stored procedures? Thanks.
Hi, when I do mysqladmin processlist ...., to see the open connections to the server, I see many open connections in "sleep" state, still open much longer than the wait_timeout variable. Shouldn't these connections be deleted/closed permanently by the database since they exceeded the wait_timeout? Thanks.
I have below lines in my my.cnf file:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
old_passwords=1

set-variable = table_cache=1200
set-variable = connect_timeout=12
set-variable = wait_timeout=7200
....

When I re-start MySQL, it picks up all the variables correctly, except wait_timeout. MySQL version is 4.1 and running on Linux.

Cannot figure why it is not picking up the wait_timeout.