This /seems/ to be a Hibernate issue. PersistentClass.getIdentifierProperty() is apparently returning null.

On second thought this seems just natural since there is no property 
representing your Id.

Uli

On 19.08.2009 12:39 schrieb Britske:
I'm in the process of updating from 5.0.17 to 5.1.0.5 and breaking my head on
this one:
Getting a NullPointerException in HibernateEntityValueEncoder when trying to
loop a hibernate Entity where the entity has a multi-column id.
I actually have this with every entity with a multi-column id so please
consider the below as an example of the generalized case. See relevant
snippets as well as trace below. 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)
I double checked this by transforming the mapped class to contain a single
id instead of the multi-column id
(I simply concatenated the columns that made up the id in sql and updated
this value to a new column. Afterwards I assigned this new column to be the
id of the table, and updated the hibernate entity accordingly. )

Afterwards the code just works.
Is there a reason why multi-column entities don't seem to be working in my
case? All dependencies are correct as far as I can tell. Anyone experienced
this?

relevant code:
.tml
------------------------
<t:loop source="CityTemperaturesOrEmptyIfNonFound" value="CurCityTemp"> <!--
LINE GIVING ERROR -->
${CurCityTemp.temp}
</t:loop>

Please note that simply calling CityTemperaturesOrEmptyIfNonFound from a
different method just works and returned results. It's just that the
looping-code raises the error because the entity can't be encoded.
(stacktrace at the end)

relevant part of old entity class:  (FAILS)
-------------------------------------------
@Entity
@Table(name = "citytemperatures")
@IdClass(CityTemperatureId.class) //CityTemperatureId is default id class
combining two columns
public class CityTemperatureBak
{
        @Id
private String cityid;
        @Id
        private String dateid;
}

relevant part of new entity class (WORKS) -------------------------------------------
@Entity
@Table(name = "citytemperatures")
public class CityTemperature
{
        @Id
private String id; private String cityid; private String dateid;
}

relevant part of stacktrace: ------------------------------------
Caused by: java.lang.NullPointerException
        at
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.<init>(HibernateEntityValueEncoder.java:54)
        at
org.apache.tapestry5.hibernate.HibernateModule$1.create(HibernateModule.java:100)
        at
org.apache.tapestry5.internal.services.ValueEncoderSourceImpl.getValueEncoder(ValueEncoderSourceImpl.java:49)
        at
$ValueEncoderSource_1233238c1f1.getValueEncoder($ValueEncoderSource_1233238c1f1.java)
        at
org.apache.tapestry5.internal.services.ComponentDefaultProviderImpl.defaultValueEncoder(ComponentDefaultProviderImpl.java:116)
        at
$ComponentDefaultProvider_1233238c0cd.defaultValueEncoder($ComponentDefaultProvider_1233238c0cd.java)
        at
org.apache.tapestry5.corelib.components.Loop.defaultEncoder(Loop.java:304)
        at
org.apache.tapestry5.corelib.components.Loop.containingPageDidLoad(Loop.java)
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$4.run(ComponentPageElementImpl.java:98)
        at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
        ... 61 more


Thanks Geert-Jan

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

Reply via email to