If all of the Embeddable's properties are NULL, Hibernate considers the object to be null. You can either set your Demographics to a fresh object before handing the Player to Beaneditor, or make sure that it doesn't come back null from Hibernate. The easiest way, though it always smelled bad, was to have a non-NULL dummy property in Demographics to force Hibernate to create an object. There's probably a more technically correct Hibernate way, but a dummy property works.
On Sat, Jan 31, 2015 at 1:31 PM, nhhockeyplayer nashua <[email protected]> wrote: > Folks, > > I am wondering if null properties are suppose to be dealt with morwe > gracefully within T-5.4 as everytime I create an object it works fine and is > displayed within my gallery widget but if I omit property fields declared > inside @Embeddable classes, they get stored in hibernate as nulls and any > subsequent Edits crash the app due to these omissions. Is tapestry suppose to > handle this properly to avoid crash ? > > Alleged as follows... > > I have a curious EditBlock DisplayBlock issue with regard to entity in > hibernate database. > > Here is the model layout > > I have Person.Java where Person is a base class Player class > > But Person.Java has a data member > private Demographics demographics = new Demographics(); > > and here is how Demographics is declared > > Demographics.Java... > @Embeddable > public class Demographics > > > ok so > Player extends from Person > Person has demographics > Player declares the following: > > @Column(columnDefinition = "longtext", length = 6291456) > @PropertyDescriptor(readOnly = false) > public String getBio() { > return bio; > } > > My issue is weird... Currently I can create Players at this demo site > http://psinh.ddns.net:9011/psi/home > > If I create a player it gets saved fine > > On subsequent EDIT operations (you can edit as player by clicking on any > image in Gallery)... > > Only Players who's demographics were all filled in with legitimate string > data get displayed and edited. > > The problem being... the app crashes on Players who's Demographics were > omitted on creation and all properties within the @Embedded instance are null. > > Its reproducible everytime at http://psinh.ddns.net:9011/psi/home > > > Here is the crash trace > An exception has occurred processing this request. > Render queue error in SetupRender[tynamo/PropertyEditBlocks:editor]: > Exception instantiating instance of org.tynamo.psi.psi.model.Demographics > (for component 'tynamo/PropertyEditBlocks:editor'): > org.apache.tapestry5.ioc.internal.OperationException: No service implements > the interface java.lang.String. > > with reload: Force a reload of component classes. This is often necessary > after fixing a class that previously failed to compile due to errors. > org.apache.tapestry5.internal.services.RenderQueueException > > Render queue error in SetupRender[tynamo/PropertyEditBlocks:editor]: > Exception instantiating instance of org.tynamo.psi.psi.model.Demographics > (for component 'tynamo/PropertyEditBlocks:editor'): > org.apache.tapestry5.ioc.internal.OperationException: No service implements > the interface java.lang.String. > > activeComponents > > edit/Player (class org.tynamo.psi.psi.pages.edit.PlayerEdit) > edit/Player:layout (class org.tynamo.psi.psi.components.Layout) > classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 2 > 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > 2 <t:layout title="title" > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" > xmlns:p="tapestry:parameter"> > 3 <p:subMenuBlock> > 4 <ul> > 5 <ul id="local"> > 6 </ul> > 7 </ul> > edit/Player:form (class org.apache.tapestry5.corelib.components.Form) > classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 17 > 12 > 13 <h1>${title}</h1> > 14 > 15 <br/> > 16 > 17 <t:form validate="bean"> > 18 <t:errors/> > 19 > 20 <div class="t-beaneditor"> > 21 > 22 <t:beaneditor object="mb:bean" > t:mixins="tynamo/BeanModelAdvisor"> > edit/Player:beaneditor (class > org.apache.tapestry5.corelib.components.BeanEditor) > classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 22 > 17 <t:form validate="bean"> > 18 <t:errors/> > 19 > 20 <div class="t-beaneditor"> > 21 > 22 <t:beaneditor object="mb:bean" > t:mixins="tynamo/BeanModelAdvisor"> > 23 > 24 <p:bio> > 25 <t:label for="bio">BIO</t:label> > 26 <t:textarea t:id="bio" value="bean.bio" /> > 27 </p:bio> > edit/Player:beaneditor.loop (class > org.apache.tapestry5.corelib.components.Loop) > classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, > line 3 > 1 <t:loop > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" > 2 source="model.propertyNames" formState="ITERATION" > 3 value="propertyName"> > 4 <t:propertyEditor property="propertyName" object="object" > model="model" overrides="overrides"/> > 5 </t:loop> > edit/Player:beaneditor.propertyeditor (class > org.apache.tapestry5.corelib.components.PropertyEditor) > classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, > line 4 > 1 <t:loop > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" > 2 source="model.propertyNames" formState="ITERATION" > 3 value="propertyName"> > 4 <t:propertyEditor property="propertyName" object="object" > model="model" overrides="overrides"/> > 5 </t:loop> > tynamo/PropertyEditBlocks:editor (class > org.apache.tapestry5.corelib.components.BeanEditor) > classpath:org/tynamo/pages/PropertyEditBlocks.tml, line 58 > 53 </t:block> > 54 > 55 <t:block id="embedded"> > 56 <fieldset class="group"> > 57 <legend>${propertyEditContext.label}</legend> > 58 <t:beaneditor t:id="editor" > object="propertyEditContext.propertyValue" model="embeddedModel" /> > 59 </fieldset> > 60 </t:block> > 61 > 62 <t:block id="blob"> > 63 <label>${propertyEditContext.label}</label> > > location > classpath:org/tynamo/pages/PropertyEditBlocks.tml, line 58 > > org.apache.tapestry5.ioc.internal.util.TapestryException > > Exception instantiating instance of org.tynamo.psi.psi.model.Demographics > (for component 'tynamo/PropertyEditBlocks:editor'): > org.apache.tapestry5.ioc.internal.OperationException: No service implements > the interface java.lang.String. > > location > classpath:org/tynamo/pages/PropertyEditBlocks.tml, line 58 > > -- Jonathan Barker ITStrategic --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
