Grails
  1. Grails
  2. GRAILS-6213

hibernate mapped entity - issue with access=field

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
      None
    • Testcase included:
      yes

      Description

      Hi,

      I am trying to integrate an entity with hibernate mapping into a grails application. If there is a field mapped with access=field without corresponding getter / setter methods I get the following exception while trying to save the entity. This used to work in grails 1.1.

      Invalid property 'title' of bean class [com.tenxperts.Book]: Bean property 'title' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

      org.springframework.beans.NotReadablePropertyException: Invalid property 'title' of bean class [com.tenxperts.Book]: Bean property 'title' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
      at com.tenxperts.BookTests.testSaveBook(BookTests.groovy:15)
      at junit.framework.Test$run.call(Unknown Source)

      The following is the class
      package com.tenxperts;
      public class Book {
      private Long id;
      private String title;

      public Long getId()

      { return id; }

      public void setId(Long id)

      { this.id = id; }

      }

      & hibernate mapping

      <hibernate-mapping>
      <class name="com.tenxperts.Book"
      table="BOOK"
      discriminator-value="P">
      <id name="id" column="ID"><generator class="native" /></id>
      <property name="title" column="TITLE" access="field"/>
      </class>
      </hibernate-mapping>

      The mapping cannot be changed - I am getting this error while using the jbpm plugin - the jbpm hibernate mapping has many instance of the above problem. I have attached a very simple test case that reproduces this issue.

      Regards,
      Kamal

        Activity

        Hide
        Lim Chee Kin added a comment -

        I am facing the same problem in Grails 1.3.1

        Show
        Lim Chee Kin added a comment - I am facing the same problem in Grails 1.3.1
        Hide
        Sven Lange added a comment -

        Discovered the same problem in 1.3.3 after trying to upgrade from Grails version 1.1.2

        Show
        Sven Lange added a comment - Discovered the same problem in 1.3.3 after trying to upgrade from Grails version 1.1.2

          People

          • Assignee:
            Unassigned
            Reporter:
            Kamal Govindraj
          • Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development