问题
I am trying to implement many to many mapping with liferay service builder. I have found one blog on liferay savvy which explains how to implement it and provides a war file as well.
You can download from here.
It gets deployed successfully and also allows you to create student and courses along with their mapping.
After adding some dummy data when I try to fetch courses based on student id with
List<Course> studentCourseList = CourseLocalServiceUtil.getStudentCourses(xxxx)
where xxxx is student id captured from meera_students_courses table. and then iterating it over for loop
for(Course course : studentCourseList){
...
}
I got java.lang.ClassCastException: com.meera.db.model.impl.CourseImpl cannot be cast to com.meera.db.model.Course exception.
I have checked the list size and it gives proper count. So iteration of the list where casting happens, gives above exception.
Any help on this is appreciated.
来源:https://stackoverflow.com/questions/32334402/classcastexception-while-implementing-many-to-many-mapping-with-liferay-service