You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Stefano Tranquillini <st...@gmail.com> on 2007/12/13 19:24:55 UTC

QueryforList and Generics

Hi everybody.
I've a problem. How i can resolve the warning when i try to do this:

List<Contatto> contatti = null;
contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
aq);

the warning is:
found   : java.util.List
required: java.util.List<it.enginsoft.qo.bean.admin.Contatto>

tnx
bye


-- 
Stefano

Re: QueryforList and Generics

Posted by Jeff Butler <je...@gmail.com>.
+1

I'd only add that Niels' solution is the coolest!  Then you only have the
dreaded annotation in one spot.  The is the closest you can get to
"resolving" this with iBATIS in its current form.  Perhaps we can do
something about it (like Neils' solution) for iBATIS 3.0 - and no, I don't
know when that will be coming out.

Jeff Butler



On Dec 13, 2007 4:40 PM, Larry Meadors <lm...@apache.org> wrote:

> You can't.
>
> If you think about it, it'll make sense. The sqlMapClient returns
> lists of objects, to 'resolve' the warning, you'd have to make it
> return lists of *your* objects...at compile time.
>
> That can't happen. :-)
>
> The 'resolution' is to suppress the warnings.
>
> Larry
>
>
> On Dec 13, 2007 3:25 PM, Stefano Tranquillini
>  <st...@gmail.com> wrote:
> > Yes. I can hide the warning but i want resolve not hide.
> >
> >
> >
> >
> >
> >
> >
> >
> > On Dec 13, 2007 9:44 PM, Jeff Butler < jeffgbutler@gmail.com> wrote:
> > >
> > > This warning is a *compiler* warning.  Probably your IDE or compiler
> has a
> > way to turn it off.  For example, in Eclipse go to:
> > >
> > > Window->Preferences->Java->Compiler->Errors/Warnings
> > >
> > > Then disable the warning for "Unchecked generic type" operation.
> > >
> > > Jeff Butler
> > >
> > >
> > >
> > >
> > >
> > > On Dec 13, 2007 1:06 PM, Stefano Tranquillini
> > <st...@gmail.com> wrote:
> > >
> > > > Hi,
> > > > there is a "little" problem
> > > > i've 100 total warning in a 68 strutc action. there isn't a place
> where
> > put the "Magic string" and this is valid for all?
> > > > maybe in the bean or something else?
> > > > bye
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Dec 13, 2007 7:38 PM, Brian Parkinson <pa...@avaning.com> wrote:
> > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi Stefano:
> > > > >
> > > > >
> > > > > Just put that magic line right above the method that is
> complaining,
> > and the warning will go away.
> > > > >
> > > > >
> > > > >
> > > > > parki...
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> >
> > > > >
> > > > > From: Stefano Tranquillini [mailto: stefano.tranquillini@gmail.com
> ]
> > > > > Sent: Thursday, December 13, 2007 12:37 PM
> > > > > To: user-java@ibatis.apache.org
> > > > > Subject: Re: QueryforList and Generics
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Where?
> > > > > but, this is the only way to resolve?
> > > > > there isn't a methtod to resolve it?
> > > > >
> > > > >
> > > > > On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com >
> wrote:
> > > > >
> > > > >
> > > > > Add this annotation:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > @SuppressWarnings( "unchecked")
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Jeff Butler
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Dec 13, 2007 12:24 PM, Stefano Tranquillini
> > <stefano.tranquillini@gmail.com > wrote:
> > > > >
> > > > > Hi everybody.
> > > > > I've a problem. How i can resolve the warning when i try to do
> this:
> > > > >
> > > > > List<Contatto> contatti = null;
> > > > > contatti =
> > sqlMap.getSqlMap
> ().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> > aq);
> > > > >
> > > > > the warning is:
> > > > > found   : java.util.List
> > > > > required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
> > > > >
> > > > > tnx
> > > > > bye
> > > > >
> > > > >
> > > > > --
> > > > > Stefano
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Stefano
> > > >
> > > >
> > > >
> > > > --
> > > > Stefano
> > >
> > >
> >
> >
> >
> > --
> > Stefano
>

Re: QueryforList and Generics

Posted by Larry Meadors <lm...@apache.org>.
You can't.

If you think about it, it'll make sense. The sqlMapClient returns
lists of objects, to 'resolve' the warning, you'd have to make it
return lists of *your* objects...at compile time.

That can't happen. :-)

The 'resolution' is to suppress the warnings.

Larry


On Dec 13, 2007 3:25 PM, Stefano Tranquillini
<st...@gmail.com> wrote:
> Yes. I can hide the warning but i want resolve not hide.
>
>
>
>
>
>
>
>
> On Dec 13, 2007 9:44 PM, Jeff Butler < jeffgbutler@gmail.com> wrote:
> >
> > This warning is a *compiler* warning.  Probably your IDE or compiler has a
> way to turn it off.  For example, in Eclipse go to:
> >
> > Window->Preferences->Java->Compiler->Errors/Warnings
> >
> > Then disable the warning for "Unchecked generic type" operation.
> >
> > Jeff Butler
> >
> >
> >
> >
> >
> > On Dec 13, 2007 1:06 PM, Stefano Tranquillini
> <st...@gmail.com> wrote:
> >
> > > Hi,
> > > there is a "little" problem
> > > i've 100 total warning in a 68 strutc action. there isn't a place where
> put the "Magic string" and this is valid for all?
> > > maybe in the bean or something else?
> > > bye
> > >
> > >
> > >
> > >
> > >
> > > On Dec 13, 2007 7:38 PM, Brian Parkinson <pa...@avaning.com> wrote:
> > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi Stefano:
> > > >
> > > >
> > > > Just put that magic line right above the method that is complaining,
> and the warning will go away.
> > > >
> > > >
> > > >
> > > > parki...
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________
>
> > > >
> > > > From: Stefano Tranquillini [mailto: stefano.tranquillini@gmail.com]
> > > > Sent: Thursday, December 13, 2007 12:37 PM
> > > > To: user-java@ibatis.apache.org
> > > > Subject: Re: QueryforList and Generics
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Where?
> > > > but, this is the only way to resolve?
> > > > there isn't a methtod to resolve it?
> > > >
> > > >
> > > > On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:
> > > >
> > > >
> > > > Add this annotation:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > @SuppressWarnings( "unchecked")
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Jeff Butler
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Dec 13, 2007 12:24 PM, Stefano Tranquillini
> <stefano.tranquillini@gmail.com > wrote:
> > > >
> > > > Hi everybody.
> > > > I've a problem. How i can resolve the warning when i try to do this:
> > > >
> > > > List<Contatto> contatti = null;
> > > > contatti =
> sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> aq);
> > > >
> > > > the warning is:
> > > > found   : java.util.List
> > > > required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
> > > >
> > > > tnx
> > > > bye
> > > >
> > > >
> > > > --
> > > > Stefano
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Stefano
> > >
> > >
> > >
> > > --
> > > Stefano
> >
> >
>
>
>
> --
> Stefano

Re: QueryforList and Generics

Posted by Stefano Tranquillini <st...@gmail.com>.
Yes. I can hide the warning but i want resolve not hide.




On Dec 13, 2007 9:44 PM, Jeff Butler <je...@gmail.com> wrote:

> This warning is a *compiler* warning.  Probably your IDE or compiler has a
> way to turn it off.  For example, in Eclipse go to:
>
> Window->Preferences->Java->Compiler->Errors/Warnings
>
> Then disable the warning for "Unchecked generic type" operation.
>
> Jeff Butler
>
> On Dec 13, 2007 1:06 PM, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>
> > Hi,
> > there is a "little" problem
> > i've 100 total warning in a 68 strutc action. there isn't a place where
> > put the "Magic string" and this is valid for all?
> > maybe in the bean or something else?
> > bye
> >
> >
> > On Dec 13, 2007 7:38 PM, Brian Parkinson <pa...@avaning.com> wrote:
> >
> > >  Hi Stefano:
> > >
> > >
> > > Just put that magic line right above the method that is complaining,
> > > and the warning will go away.
> > >
> > >
> > >
> > > parki...
> > >
> > >
> > >
> > >
> > >  ------------------------------
> > >
> > > *From:* Stefano Tranquillini [mailto: stefano.tranquillini@gmail.com]
> > > *Sent:* Thursday, December 13, 2007 12:37 PM
> > > * To:* user-java@ibatis.apache.org
> > > *Subject:* Re: QueryforList and Generics
> > >
> > >
> > >
> > > Where?
> > > but, this is the only way to resolve?
> > > there isn't a methtod to resolve it?
> > >
> > > On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:
> > >
> > > Add this annotation:
> > >
> > >
> > >
> > > @SuppressWarnings( "unchecked")
> > >
> > >
> > >
> > > Jeff Butler
> > >
> > >
> > >
> > > On Dec 13, 2007 12:24 PM, Stefano Tranquillini <
> > > stefano.tranquillini@gmail.com > wrote:
> > >
> > > Hi everybody.
> > > I've a problem. How i can resolve the warning when i try to do this:
> > >
> > > List<Contatto> contatti = null;
> > > contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> > > aq);
> > >
> > > the warning is:
> > > found   : java.util.List
> > > required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
> > >
> > > tnx
> > > bye
> > >
> > >
> > > --
> > > Stefano
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Stefano
> > >
> >
> >
> >
> > --
> > Stefano
>
>
>


-- 
Stefano

Re: QueryforList and Generics

Posted by Jeff Butler <je...@gmail.com>.
This warning is a *compiler* warning.  Probably your IDE or compiler has a
way to turn it off.  For example, in Eclipse go to:

Window->Preferences->Java->Compiler->Errors/Warnings

Then disable the warning for "Unchecked generic type" operation.

Jeff Butler

On Dec 13, 2007 1:06 PM, Stefano Tranquillini <
stefano.tranquillini@gmail.com> wrote:

> Hi,
> there is a "little" problem
> i've 100 total warning in a 68 strutc action. there isn't a place where
> put the "Magic string" and this is valid for all?
> maybe in the bean or something else?
> bye
>
>
> On Dec 13, 2007 7:38 PM, Brian Parkinson <pa...@avaning.com> wrote:
>
> >  Hi Stefano:
> >
> >
> > Just put that magic line right above the method that is complaining, and
> > the warning will go away.
> >
> >
> >
> > parki...
> >
> >
> >
> >
> >  ------------------------------
> >
> > *From:* Stefano Tranquillini [mailto:stefano.tranquillini@gmail.com]
> > *Sent:* Thursday, December 13, 2007 12:37 PM
> > *To:* user-java@ibatis.apache.org
> > *Subject:* Re: QueryforList and Generics
> >
> >
> >
> > Where?
> > but, this is the only way to resolve?
> > there isn't a methtod to resolve it?
> >
> > On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:
> >
> > Add this annotation:
> >
> >
> >
> > @SuppressWarnings( "unchecked")
> >
> >
> >
> > Jeff Butler
> >
> >
> >
> > On Dec 13, 2007 12:24 PM, Stefano Tranquillini <
> > stefano.tranquillini@gmail.com > wrote:
> >
> > Hi everybody.
> > I've a problem. How i can resolve the warning when i try to do this:
> >
> > List<Contatto> contatti = null;
> > contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> > aq);
> >
> > the warning is:
> > found   : java.util.List
> > required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
> >
> > tnx
> > bye
> >
> >
> > --
> > Stefano
> >
> >
> >
> >
> >
> >
> > --
> > Stefano
> >
>
>
>
> --
> Stefano

Re: QueryforList and Generics

Posted by Stefano Tranquillini <st...@gmail.com>.
Hi,
there is a "little" problem
i've 100 total warning in a 68 strutc action. there isn't a place where put
the "Magic string" and this is valid for all?
maybe in the bean or something else?
bye

On Dec 13, 2007 7:38 PM, Brian Parkinson <pa...@avaning.com> wrote:

>  Hi Stefano:
>
>
> Just put that magic line right above the method that is complaining, and
> the warning will go away.
>
>
>
> parki...
>
>
>
>
>  ------------------------------
>
> *From:* Stefano Tranquillini [mailto:stefano.tranquillini@gmail.com]
> *Sent:* Thursday, December 13, 2007 12:37 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: QueryforList and Generics
>
>
>
> Where?
> but, this is the only way to resolve?
> there isn't a methtod to resolve it?
>
> On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:
>
> Add this annotation:
>
>
>
> @SuppressWarnings("unchecked")
>
>
>
> Jeff Butler
>
>
>
> On Dec 13, 2007 12:24 PM, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>
> Hi everybody.
> I've a problem. How i can resolve the warning when i try to do this:
>
> List<Contatto> contatti = null;
> contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> aq);
>
> the warning is:
> found   : java.util.List
> required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
>
> tnx
> bye
>
>
> --
> Stefano
>
>
>
>
>
>
> --
> Stefano
>



-- 
Stefano

RE: QueryforList and Generics

Posted by Brian Parkinson <pa...@avaning.com>.
Hi Stefano:


Just put that magic line right above the method that is complaining, and
the warning will go away.

 

parki...

 

 

________________________________

From: Stefano Tranquillini [mailto:stefano.tranquillini@gmail.com] 
Sent: Thursday, December 13, 2007 12:37 PM
To: user-java@ibatis.apache.org
Subject: Re: QueryforList and Generics

 

Where?
but, this is the only way to resolve?
there isn't a methtod to resolve it?

On Dec 13, 2007 7:33 PM, Jeff Butler <jeffgbutler@gmail.com > wrote:

Add this annotation:

 

@SuppressWarnings("unchecked")

 

Jeff Butler

 

On Dec 13, 2007 12:24 PM, Stefano Tranquillini
<st...@gmail.com> wrote:

Hi everybody.
I've a problem. How i can resolve the warning when i try to do this:

List<Contatto> contatti = null; 
contatti =
sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Question
ario_aggiungi", aq); 

the warning is:
found   : java.util.List
required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >

tnx
bye


-- 
Stefano 

 




-- 
Stefano 


Re: QueryforList and Generics

Posted by Stefano Tranquillini <st...@gmail.com>.
Where?
but, this is the only way to resolve?
there isn't a methtod to resolve it?

On Dec 13, 2007 7:33 PM, Jeff Butler <je...@gmail.com> wrote:

> Add this annotation:
>
> @SuppressWarnings("unchecked")
>
> Jeff Butler
>
>
> On Dec 13, 2007 12:24 PM, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>
> > Hi everybody.
> > I've a problem. How i can resolve the warning when i try to do this:
> >
> > List<Contatto> contatti = null;
> > contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> > aq);
> >
> > the warning is:
> > found   : java.util.List
> > required: java.util.List<it.enginsoft.qo.bean.admin.Contatto >
> >
> > tnx
> > bye
> >
> >
> > --
> > Stefano
>
>
>


-- 
Stefano

Re: QueryforList and Generics

Posted by Jeff Butler <je...@gmail.com>.
Add this annotation:

@SuppressWarnings("unchecked")

Jeff Butler


On Dec 13, 2007 12:24 PM, Stefano Tranquillini <
stefano.tranquillini@gmail.com> wrote:

> Hi everybody.
> I've a problem. How i can resolve the warning when i try to do this:
>
> List<Contatto> contatti = null;
> contatti = sqlMap.getSqlMap().queryForList("get_Contatti_from_Nome_Cognome_Questionario_aggiungi",
> aq);
>
> the warning is:
> found   : java.util.List
> required: java.util.List<it.enginsoft.qo.bean.admin.Contatto>
>
> tnx
> bye
>
>
> --
> Stefano