Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Object Relational Mapping
org.hibernate.PropertyAccessException
indu iyengar
Ranch Hand
Posts: 115
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all am using a many to many relationship and when I try to save the object , it shows the exception..
org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.bean.Course.courseID
my mapping file is :::
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.bean"> <class name="RegisterStudent" table="details_student"> <id name="stid" type="long" column="studID"> <generator class="increment"/> </id> <property name="stname" column="studName"></property> <property name="stpw" column="studPW"></property> <property name="dob" column="DOB"></property> <list name="listOfCourses" table="stud_course" cascade="all" inverse="true"> <key column="studID"></key> <index column="idx"></index> <many-to-many column="courseID" class="Course"></many-to-many> </list> </class> <class name="Course" table="courses"> <id name="courseID" type="long" column="courseID" access="field"></id> <property name="courseName" column="courseName"></property> <property name="creditPoints" column="creditPoints"></property> </class> </hibernate-mapping>
course bean is :::
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.bean"> <class name="RegisterStudent" table="details_student"> <id name="stid" type="long" column="studID"> <generator class="increment"/> </id> <property name="stname" column="studName"></property> <property name="stpw" column="studPW"></property> <property name="dob" column="DOB"></property> <list name="listOfCourses" table="stud_course" cascade="all" inverse="true"> <key column="studID"></key> <index column="idx"></index> <many-to-many column="courseID" class="Course"></many-to-many> </list> </class> <class name="Course" table="courses"> <id name="courseID" type="long" column="courseID" access="field"></id> <property name="courseName" column="courseName"></property> <property name="creditPoints" column="creditPoints"></property> </class> </hibernate-mapping>
please please, am changing by googling but still getting the exception..
please help me ...
thanks ,
Indu
Waswani Naresh
Ranch Hand
Posts: 66
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please provide your POJO classes as well.
Regards,
Naresh Waswani
Naresh Waswani
indu iyengar
Ranch Hand
Posts: 115
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
oh ! I posted mapping file again instead of pojo ..
Course pojo ::
import java.io.Serializable; public class Course implements Serializable { private long courseID; private String courseName; private Integer creditPoints; public void setCourseName(String courseName) { this.courseName = courseName; } public String getCourseName() { return courseName; } public void setCreditPoints(Integer creditPoints) { this.creditPoints = creditPoints; } public Integer getCreditPoints() { return creditPoints; } public void setCourseID(long courseID) { this.courseID = courseID; } public long getCourseID() { return courseID; } }
thanks ,
Indu
Waswani Naresh
Ranch Hand
Posts: 66
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please provide RegisterStudent POJO and the code for inserting the object as well.
Regards,
Naresh Waswani
Naresh Waswani
Rishi Shehrawat
Ranch Hand
Posts: 218
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Could you also provide complete stack trace.
Interesting thing is that for the courseID field you have specified access="field" in your mapping file, still Hibernate is trying to use getter.
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
sequence generator with mysql
org.hibernate.NonUniqueObjectException
org.hibernate.exception.SQLGrammarException: could not insert: [com.Course]
problem in one-to-many mapping
mapping exception with generator - sequence
More...