[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7202) No warning when declared targetEntity class doesn't match type of property

Alex Cruise (JIRA) noreply at atlassian.com
Tue Mar 27 16:49:48 EDT 2012


No warning when declared targetEntity class doesn't match type of property
--------------------------------------------------------------------------

                 Key: HHH-7202
                 URL: https://hibernate.onjira.com/browse/HHH-7202
             Project: Hibernate ORM
          Issue Type: Bug
          Components: entity-manager
    Affects Versions: 4.1.1
            Reporter: Alex Cruise


I had a mapping error like this:

  @ManyToOne(targetEntity=Foo.class, fetch=FetchType.EAGER)
  Bar bar;

The evidence for the error wound up being low-level and far removed:

  java.lang.Exception: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of Foo.id

If there's any way that these correspondences could be validated earlier, it would be nice!  Specifically, the type of the property should be assignable from the annotation's targetEntity class (or is it the opposite?  I seem to be incapable of remembering which direction isAssignableFrom goes.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list