You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jens Breitenstein <ma...@j-b-s.de> on 2013/05/04 18:52:56 UTC

HibernateEntityValueEncoder NPE

Hi All!

I detected a bug(?) in the HibernateEntityValueEncoder. When the 
hibernate entity's primary key contains an underscore in the primary key 
member name like

     private Long _pk;

than the HibernateValueEncoder fails with:

Caused by: java.lang.NullPointerException
     at 
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:59)
     at org.apache.tapestry5.corelib.components.Loop.begin(Loop.java:396)
     at org.apache.tapestry5.corelib.components.Loop.beginRender(Loop.java)
     at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$BeginRenderPhase.invokeComponent(ComponentPageElementImpl.java:202)
     at 
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:143)


because the "propertyAdapter.get" method returns "null" for the given 
entity instance. The root cause for this is here 
(HibernateValueEncoder:51):

         propertyAdapter = 
propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(property.getName());

as property.getName returns "_pk" which is not in the list of adapters, 
but "pk" is...
The easy work around is just to rename all my _pk fields, but as 
Tapestry is happy with "leading underscores" the hibernate integration 
should be too?

Is there something wrong on my side or shall I fill a jira?


Jens

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org