Hello Sara,

This problem was discussed in this list a few months ago and an interesting
solution had been proposed, here is the link:

http://www.mail-archive.com/[email protected]/msg10288.html

I have even pushed this solution a bit further this way:

[in an AbstractDAO class]

@SuppressWarnings("unchecked")
protected<T> List<T> queryForList(String id, Object param)
        throws SQLException
{
    return _client.queryForList(id, param);
}

Compared with Niels's proposal, this solution eliminates the Class<T>
argument, which is not always needed. Please note however, that there are
some cases where the compiler will not be able to use this solution, but
these cases should be extremely rare in a DAO class, since common usage
would be:

public List<Customer> searchCustomers(CustomersSearchCriteria criteria)
{
        return queryForList("selectAllCustomers", criteria);
}

In this situation, the compiler will never complain.

Cheers

Jean-Francois

-----Original Message-----
From: Sara [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 03, 2008 12:53 AM
To: [email protected]
Subject: RE: Problem with raw type.


Thank you all for the help and information you give me. 
Yes Chris I am new to java5 as well for Ibatis, thank you for the overview.


Regards,
Sara.


-----Original Message-----
From: Chris O'Connell [mailto:[EMAIL PROTECTED] 
Sent: vrijdag 2 mei 2008 19:32
To: [email protected]
Subject: RE: Problem with raw type.

Sara,

Someone else pointed out that is actually a warning about your using an
untyped list.  You may be new to java5 as well as iBatis.

This is a good overview of what generics are:
http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html

Good luck.  Once you get the hang of them, you will realize that generics
are your friend...

-----Original Message-----
From: Sara [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 02, 2008 11:27 AM
To: [email protected]
Cc: [EMAIL PROTECTED]
Subject: RE: Problem with raw type.

Hi Irwin,

No I don't get an Exception, the warning that I get is in Eclipse.
The application works fine when I test it, I thought there is maybe a better
way when I get the warning.
I am new to Ibatis therefore I post my message.

Sara.
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.524 / Virus Database: 269.23.7/1411 - Release Date: 5/2/2008
8:02 AM
 



Reply via email to