Trying to modify petclinic . Created 3 tables in the database. it

  • Lessons(id,name,teacher,description)
  • Students(id,first_name,last_name,birthday,faculty)
  • Group(id_student,id_lesson)

Here is a piece **. Hbm.xml

 <class name="org.springframework.samples.petclinic.Students" table="students"> <id name="id" column="id"> <generator class="increment" /> </id> <property name="first_name" type="java.lang.String" not-null="true" /> <property name="last_name" type="java.lang.String" not-null="true" /> <property name="birthday" type="java.util.Date" column="birthday" /> <property name="faculty" type="int" /> <set name="lessonsInternal" table="group"> <key column="student_id" /> <many-to-many column="lesson_id" class="org.springframework.samples.petclinic.Lessons" /> </set> </class> <class name="org.springframework.samples.petclinic.Lessons" table="lessons"> <id name="id" column="id"> <generator class="increment" /> </id> <property name="name" type="java.lang.String" not-null="true" /> <property name="teacher" type="java.lang.String" not-null="true" /> <property name="description" type="java.lang.String" not-null="true" /> </class> 

Bins:

 public class BaseEntity { private Integer id; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } public boolean isNew() { return (this.id == null); } } package org.springframework.samples.petclinic; import java.util.Date; public class Students extends BaseEntity { private String first_name; private String last_name; private Date birthday; private int faculty; private boolean changed; public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public int getFaculty() { return faculty; } public void setFaculty(int facult) { this.faculty = facult; } public boolean isChanged() { return changed; } public void setChanged(boolean changed) { this.changed = changed; } } package org.springframework.samples.petclinic; public class Lessons extends BaseEntity { private String name; private String teacher; private String description; private boolean changed; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTeacher() { return teacher; } public void setTeacher(String teacher) { this.teacher = teacher; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public boolean isChanged() { return changed; } public void setChanged(boolean changed) { this.changed = changed; } } 

Well, actually the error itself:

Caused by: org.hibernate.PropertyNotFoundException: I couldn’t find a way to get it in the classroom at the schoolgroup.pringframework.samples.petclinic.Students at org. .BasicPropertyAccessor.getGetter (BasicPropertyAccessor.java:299) at org.hibernate.mapping.Property.getGetter (Property.java:294) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter (PojoEnttyTyTeTyTeTyTyTyTyTyTyTyTeTyTeTyTeTyTeTyTeTeTyEntityTypeGetter (BasicPropertyAccessor.java:299) hibernate.tuple.entity.AbstractEntityTuplizer. <init> (AbstractEntityTuplizer.java:141) at org.hibernate.tuple.entity. PojoEntityTuplizer. <init> (PojoEntityTuplizer.java:78) ... 38 more

    1 answer 1

    Something suggests that the error in xml in terms of the correctness of the variable name ...

     Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for lessonsInternal in class org.springframework.samples.petclinic.Students 
    • Grateful !! - smail2133
    • why not, this is an assumption, with a familiarity on a superficial level, of course they get the errors inconvenient for analysis ... - thunder