When compiling my class which is a table in my ActiveAndroid ORM database I get this error:
Warning:(33, 50) non-varargs call of varargs method with inexact argument type for last parameter; cast to Object for a varargs call cast to Object[] for a non-varargs call and to suppress this warning
Here is the method which this refers to:
public static ChildMedicine getChildMedicine(Child child, Medicine medicine)
{
return new Select()
.from(ChildMedicine.class)
.where("Child = ? AND Medicine = ?", new Long[]{child.getId(), medicine.getId()})
.executeSingle();
}
I want to return all the ChildMedicine objects from my ActiveAndroid ORM database table where the Child column equals the Long Id for the passed in child argument and the Medicine column equals the Long Id for the passed in medicine argument.
I am suggested to wrap the wrap vararg arguments with explicit array creation like this:
public static ChildMedicine getChildMedicine(Child child, Medicine medicine)
{
return new Select()
.from(ChildMedicine.class)
.where("Child = ? AND Medicine = ?", new Object[]{new Long[]{child.getId(), medicine.getId()}})
.executeSingle();
}
However, will this not cause my Select() method not to work correctly as I now have an array of two Long arrays instead of a Long array of two Longs in the where part of the method?
I am a bit confused!
Any help is much appreciated...
Thanks, Sam
Aucun commentaire:
Enregistrer un commentaire