I'm not sure if HibernateEntityValueEncoder called PersistentClass.getIdentifierProperty() before (in 5.0.x) when my code worked...
getIdentifierProperty() returns an instance of hibernate.mapping.Property which may be a Composite ID (which seems to be the official name for multi-column ids). In other words this method should return the id-property of my class even though this 'property' isn't defined by a single field in my case. So I think it should return a property, although a multi-valued one. All this indeed strongly suggests that it is a hibernate issue.. I will investigate further. Thanks. Ulrich Stärk wrote: > > 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 > > > -- View this message in context: http://www.nabble.com/T5%3A-HibernateEntityValueEncoder-nullpointerException-after-Tapestry-update-tp25041718p25042186.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org