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

Reply via email to