jss
unread,Jan 22, 2012, 12:27:01 AM1/22/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework
This is my query using entity manager. Trying to join 2 table with
play framework and jpa.
List<Object> joinQryResult = JPA.em().createNativeQuery(
"select e.elementname as elementname, " +
"c.comparetype as comparetype, " +
"jd.matchvalue as matchvalue " +
"from details jd " +
"join elements e on jd.elementnamerid = e.rid " +
"join comparers c on jd.comparetyperid = c.rid " +
"where jd.rid = " + temp.rid).getResultList();
Not sure how to iterate and get the values from List<Object>
I tried this
List<MyClass> myClass = (List<MyClass>)(Object)joinQryResult;
for(MyClass myC:jd)
{
System.out.println(myC.ElementName); //intellisense shows the
property here
}
MyClass definition: ttrying to convert List<object> to this type
public class MyClass {
public String ElementName;
public String CompareType;
public String MatchValue;
public JobDetails(String ElementName, String CompareType,
String MatchValue)
{
this.ElementName = ElementName;
this.CompareType = CompareType;
this.MatchValue = MatchValue;
}
}
Get this error
ClassCastException occured : [Ljava.lang.Object; cannot be cast to
models.MyClass