Re: @Embedded properties null not supported in T5.4 ???
I meant have a non-nullable field in Demographics. Such as: class Demographics { private int dummy; public int getDummy(){ return dummy; } public void setDummy( int value) { this.dummy = dummy; } } Because this is a primitive, the "uninitialized" value is "0" and not NULL, so Hibernate will persist a "0" and force creation of the Demographics object on retrieval to store that "0". The problem with what you have is that your constructor sets the value of demographics to something non-null, and Hibernate comes along and populates the "correct" null value retrieved from the database. After all, you don't really have demographics if all of the properties are null. There are other legitimate cases where you really can have an embeddable object with all null properties, but I digress. As I think about it… why not change the getter? public Demographics getDemographics(){ if (demographics == null) demographics = new Demographics(); return demographics; } It's not what I think of as a getter, but I've done worse things. I'm not sure if there's a down side to it, but it feels less hack-ish that polluting your database with useless information. Well, there you have it, try modifying your getter. It feels less bad. On Mon, Feb 2, 2015 at 2:46 PM, nhhockeyplayer nashua wrote: > Thanks Jonathan. > > Person.JAVA > private Demographics demographics = new Demographics(); > > is this what you meant? I though this is already sufficient for hibernate > because its original code and this worked before so I am wondering why it > isnt working now...thats why I felt it was schema issue. > > > Best regards > and thanks... KEN > > From: nhhockeypla...@hotmail.com > To: users@tapestry.apache.org > Subject: RE: @Embedded properties null not supported in T5.4 ??? > Date: Sun, 1 Feb 2015 07:34:00 -0500 > > > > > this could be a database schema issue > > i restored a partial group of entities on this shema from past rev > > likely it is that and I should start clean > > I wonder what the schema migration semantics are for large scale systems > > years ago at Hewlett Packard we operated a fairly commercial one that ran at > setup time and overlayed > -- Jonathan Barker ITStrategic - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: @Embedded properties null not supported in T5.4 ???
Thanks Jonathan. Person.JAVA private Demographics demographics = new Demographics(); is this what you meant? I though this is already sufficient for hibernate because its original code and this worked before so I am wondering why it isnt working now...thats why I felt it was schema issue. Best regards and thanks... KEN From: nhhockeypla...@hotmail.com To: users@tapestry.apache.org Subject: RE: @Embedded properties null not supported in T5.4 ??? Date: Sun, 1 Feb 2015 07:34:00 -0500 this could be a database schema issue i restored a partial group of entities on this shema from past rev likely it is that and I should start clean I wonder what the schema migration semantics are for large scale systems years ago at Hewlett Packard we operated a fairly commercial one that ran at setup time and overlayed
Re: @Embedded properties null not supported in T5.4 ???
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 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 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > 2 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"; > xmlns:p="tapestry:parameter"> > 3 > 4 > 5 > 6 > 7 > edit/Player:form (class org.apache.tapestry5.corelib.components.Form) > classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 17 > 12 > 13${title} > 14 > 15 > 16 > 17 > 18 > 19 > 20 > 21 > 22 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 > 18 > 19 > 20 > 21 > 22 t:mixins="tynamo/BeanModelAdvisor"> > 23 > 24 > 25BIO > 26 > 27 > edit/Player:beaneditor.loop (class > org.apache.tapestry5.corelib.components.Loop) > classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, > line 3 > 1 xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"; > 2source="model.propertyNames" formState="ITERATION" > 3value="propertyName"> > 4 model="model" overrides="overrides"/> > 5 > edit/Player:beaneditor.propertyeditor (class > org.apache.tapestry5.corelib.components.Property
RE: @Embedded properties null not supported in T5.4 ???
this could be a database schema issue i restored a partial group of entities on this shema from past rev likely it is that and I should start clean I wonder what the schema migration semantics are for large scale systems years ago at Hewlett Packard we operated a fairly commercial one that ran at setup time and overlayed
@Embedded properties null not supported in T5.4 ???
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 1http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> 2http://tapestry.apache.org/schema/tapestry_5_3.xsd"; xmlns:p="tapestry:parameter"> 3 4 5 6 7 edit/Player:form (class org.apache.tapestry5.corelib.components.Form) classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 17 12 13${title} 14 15 16 17 18 19 20 21 22 edit/Player:beaneditor (class org.apache.tapestry5.corelib.components.BeanEditor) classpath:org/tynamo/psi/psi/pages/edit/PlayerEdit.tml, line 22 17 18 19 20 21 22 23 24 25BIO 26 27 edit/Player:beaneditor.loop (class org.apache.tapestry5.corelib.components.Loop) classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 3 1http://tapestry.apache.org/schema/tapestry_5_3.xsd"; 2source="model.propertyNames" formState="ITERATION" 3value="propertyName"> 4 5 edit/Player:beaneditor.propertyeditor (class org.apache.tapestry5.corelib.components.PropertyEditor) classpath:org/apache/tapestry5/corelib/components/BeanEditor.tml, line 4 1http://tapestry.apache.org/schema/tapestry_5_3.xsd"; 2source="model.propertyNames" formState="ITERATION" 3value="propertyName"> 4 5 tynamo/PropertyEditBlocks:editor (class org.apache.tapestry5.corelib.components.BeanEditor) classpath:org/tynamo/pages/PropertyEditBlocks.tml, line 58 53 54 55 56 57${propertyEditContext.label} 58 59 60 61 62 63${propertyEditContext.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.Demog