You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Hugo Palma (JIRA)" <ji...@apache.org> on 2010/11/10 18:55:15 UTC
[jira] Created: (TAP5-1340) HibernateEntityValueEncoder shouldn't
throw an exception when the entity being encoded isn't persisted yet
HibernateEntityValueEncoder shouldn't throw an exception when the entity being encoded isn't persisted yet
----------------------------------------------------------------------------------------------------------
Key: TAP5-1340
URL: https://issues.apache.org/jira/browse/TAP5-1340
Project: Tapestry 5
Issue Type: Bug
Components: tapestry-hibernate
Affects Versions: 5.2.3
Reporter: Hugo Palma
The code:
if (id == null)
throw new IllegalStateException(String.format(
"Entity %s has an %s property of null; this probably means that it has not been persisted yet.",
value, idPropertyName));
means that i can never encode an entity class before it's persisted. The correct behaviour should be:
1. HibernateEntityValueEncoder - if id is not null proceed with encoding.
2. HibernateEntityValueEncoder - if id is null then pass object to the next encoder on the chain.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] [Commented] (TAP5-1340) HibernateEntityValueEncoder
shouldn't throw an exception when the entity being encoded isn't persisted
yet
Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088849#comment-13088849 ]
Robert Zeigler commented on TAP5-1340:
--------------------------------------
ValueEncoders aren't a chain, so there's no "passing" going on. ValueEncoderSource uses a MappedConfiguration to map from the type of a value to the encoder to use, attempting to match the type as specifically as possible. So the search for the correct encoder happens before HibernateEntityValueEncoder is ever called, and only one encoder is ever attempted per value.
You need to override the contribution for your entity type provided by the hibernate module with your custom encoder.
> HibernateEntityValueEncoder shouldn't throw an exception when the entity being encoded isn't persisted yet
> ----------------------------------------------------------------------------------------------------------
>
> Key: TAP5-1340
> URL: https://issues.apache.org/jira/browse/TAP5-1340
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-hibernate
> Affects Versions: 5.2.3
> Reporter: Hugo Palma
>
> The code:
> if (id == null)
> throw new IllegalStateException(String.format(
> "Entity %s has an %s property of null; this probably means that it has not been persisted yet.",
> value, idPropertyName));
> means that i can never encode an entity class before it's persisted. The correct behaviour should be:
> 1. HibernateEntityValueEncoder - if id is not null proceed with encoding.
> 2. HibernateEntityValueEncoder - if id is null then pass object to the next encoder on the chain.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (TAP5-1340) HibernateEntityValueEncoder shouldn't
throw an exception when the entity being encoded isn't persisted yet
Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Zeigler closed TAP5-1340.
--------------------------------
Resolution: Invalid
Assignee: Robert Zeigler
> HibernateEntityValueEncoder shouldn't throw an exception when the entity being encoded isn't persisted yet
> ----------------------------------------------------------------------------------------------------------
>
> Key: TAP5-1340
> URL: https://issues.apache.org/jira/browse/TAP5-1340
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-hibernate
> Affects Versions: 5.2.3
> Reporter: Hugo Palma
> Assignee: Robert Zeigler
>
> The code:
> if (id == null)
> throw new IllegalStateException(String.format(
> "Entity %s has an %s property of null; this probably means that it has not been persisted yet.",
> value, idPropertyName));
> means that i can never encode an entity class before it's persisted. The correct behaviour should be:
> 1. HibernateEntityValueEncoder - if id is not null proceed with encoding.
> 2. HibernateEntityValueEncoder - if id is null then pass object to the next encoder on the chain.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (TAP5-1340) HibernateEntityValueEncoder
shouldn't throw an exception when the entity being encoded isn't persisted
yet
Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13088849#comment-13088849 ]
Robert Zeigler commented on TAP5-1340:
--------------------------------------
ValueEncoders aren't a chain, so there's no "passing" going on. ValueEncoderSource uses a MappedConfiguration to map from the type of a value to the encoder to use, attempting to match the type as specifically as possible. So the search for the correct encoder happens before HibernateEntityValueEncoder is ever called, and only one encoder is ever attempted per value.
You need to override the contribution for your entity type provided by the hibernate module with your custom encoder.
> HibernateEntityValueEncoder shouldn't throw an exception when the entity being encoded isn't persisted yet
> ----------------------------------------------------------------------------------------------------------
>
> Key: TAP5-1340
> URL: https://issues.apache.org/jira/browse/TAP5-1340
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-hibernate
> Affects Versions: 5.2.3
> Reporter: Hugo Palma
>
> The code:
> if (id == null)
> throw new IllegalStateException(String.format(
> "Entity %s has an %s property of null; this probably means that it has not been persisted yet.",
> value, idPropertyName));
> means that i can never encode an entity class before it's persisted. The correct behaviour should be:
> 1. HibernateEntityValueEncoder - if id is not null proceed with encoding.
> 2. HibernateEntityValueEncoder - if id is null then pass object to the next encoder on the chain.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (TAP5-1340) HibernateEntityValueEncoder shouldn't
throw an exception when the entity being encoded isn't persisted yet
Posted by "Robert Zeigler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TAP5-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Zeigler closed TAP5-1340.
--------------------------------
Resolution: Invalid
Assignee: Robert Zeigler
> HibernateEntityValueEncoder shouldn't throw an exception when the entity being encoded isn't persisted yet
> ----------------------------------------------------------------------------------------------------------
>
> Key: TAP5-1340
> URL: https://issues.apache.org/jira/browse/TAP5-1340
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-hibernate
> Affects Versions: 5.2.3
> Reporter: Hugo Palma
> Assignee: Robert Zeigler
>
> The code:
> if (id == null)
> throw new IllegalStateException(String.format(
> "Entity %s has an %s property of null; this probably means that it has not been persisted yet.",
> value, idPropertyName));
> means that i can never encode an entity class before it's persisted. The correct behaviour should be:
> 1. HibernateEntityValueEncoder - if id is not null proceed with encoding.
> 2. HibernateEntityValueEncoder - if id is null then pass object to the next encoder on the chain.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira