ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Francois Poilpret" <jfpoilp...@yahoo.fr>
Subject RE: Problem with raw type.
Date Sat, 03 May 2008 01:19:46 GMT
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/user-java@ibatis.apache.org/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:jdev02@telenet.be] 
Sent: Saturday, May 03, 2008 12:53 AM
To: user-java@ibatis.apache.org
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:oconnell@gorillachicago.com] 
Sent: vrijdag 2 mei 2008 19:32
To: user-java@ibatis.apache.org
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:jdev02@telenet.be] 
Sent: Friday, May 02, 2008 11:27 AM
To: user-java@ibatis.apache.org
Cc: cirwin@ll.mit.edu
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
 




Mime
View raw message