[ 
https://issues.apache.org/jira/browse/TAP5-920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13689062#comment-13689062
 ] 

Goran Rajta commented on TAP5-920:
----------------------------------

Hello,

I know this is a really old post but my relationship with tapestry started just 
recently. :)

I had the same problem and i SOLVED it by removing the @IdClass annotation and 
the fields in my entity who make the composite key,
and i added the field of the type MyCompositeIdClass and annotated it with 
@EmbeddedId.

Now the t:loop works fine !
Hope this helps someone, Bye! :)
                
> Loop component causes NPE for hibernate enitites using a composite-id  (ie 
> multi-column id)
> -------------------------------------------------------------------------------------------
>
>                 Key: TAP5-920
>                 URL: https://issues.apache.org/jira/browse/TAP5-920
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core, tapestry-hibernate
>    Affects Versions: 5.1.0.5
>            Reporter: Joe Klecko
>
> This issue is in reference to thread: 
> http://old.nabble.com/T5%3A-HibernateEntityValueEncoder-nullpointerException-after-Tapestry-update-ts25041718.html
> "After some investigation it SEEMS that:
> - looping of entities (for which HibernateEntityValueEncoder is called) WORKS 
> for entities with standard IDs
> - looping FAILS for entities with an @IdClass specified (i.e: multi-column id)
> - querying of all entities works (so it isn't a hibernate issue as far as I 
> can tell) "
> This issue was introduced in T5.1.x, it does not occur in 5.0.x.   From what 
> I can tell, I think it has something to do with the way the loop component is 
> creating the value encoder.  
> When debugging with T5.0.x:
> The ValueEncoderFactory  for the entity (created in 
> HibernateModule.contributeValueEncoderSource())  is never created for the 
> loop. 
> When debugging with T5.1.x:
> The ValueEncoderFactory is always created and throws an NPE when accessing 
> the value returned from persistentClass.getIdentifierProperty().  It is 
> correct for persistentClass.getIdentifierProperty() to be null when the 
> entity is using a composite-id.   
> It appears that T5.0.x is smarter about when it should and shouldn't create 
> the encoder.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to