[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1852) @MappedSuperclass - PropertyAccessException

Bas van den Berg (JIRA) noreply at atlassian.com
Tue Oct 9 11:07:38 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28389 ] 

Bas van den Berg commented on HHH-1852:
---------------------------------------

I had the same error, but not in combination of MappedSuperClass. 

I have a generic Tree object which is not hibernated, 
public class Tree<T>

In my code I use a tree of words i.e. Tree<Word>. To be able to hibernate this, I extended the Tree object, like this. 

public class WordTree extends Tree<Word>
Then I added the mapping information on the methods i.e. @AccessType("property")

Everything worked, but then I got an error at runtime error 'could not get a field value by reflection getter of Word.id'
I found out that the targettype was incorrect in WordTree. After changing it, the error went away.

	@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER, targetEntity=WordTree.class)
	@JoinTable(name = "Child",
		joinColumns = @JoinColumn(name="node_id"),
		inverseJoinColumns = @JoinColumn(name="child_id")
	)
	public List<Tree<Word>> getChilds() {
		return super.getChilds();
	}
I hope this will give the experts some more clues on where to look. 




> @MappedSuperclass - PropertyAccessException
> -------------------------------------------
>
>                 Key: HHH-1852
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1852
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.0.cr2
>         Environment: hibernate-3.2.0.cr2, hibernate-annotations-3.2.0.cr1, hibernate-entitymanager-3.2.0.cr1
>            Reporter: David de Mingo
>         Attachments: src.zip
>
>
> Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.endea.model.product.ProductAttribute.data
> 	at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
> 	at org.hibernate.property.DirectPropertyAccessor$DirectGetter.getForInsert(DirectPropertyAccessor.java:40)
> 	at org.hibernate.tuple.AbstractEntityTuplizer.getPropertyValuesToInsert(AbstractEntityTuplizer.java:264)
>     ...
> Caused by: java.lang.IllegalArgumentException
> 	at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
> 	at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
> 	at java.lang.reflect.Field.get(Field.java:357)
> 	at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32)
> 	... 41 morer

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list