Thursday 15 January 2015

hibernate - Problems with getting rid of form in ZK -



hibernate - Problems with getting rid of form in ZK -

i have piece of code tried create out myself:

<groupbox id="mygrp"> <caption label="dish" /> title: <textbox id="dishtitle" cols="25" value="@bind(vm.selecteddish.title)" /> <div> price: <decimalbox id="dishprice2" format="#,###.##" cols="10" hflex="min" value="@bind(vm.selecteddish.price)" /> </div> <hlayout> <button id="add" label="add" onclick="@command('add') @validator('eventvalidator.dishvalidator')" /> <button id="update" label="update" onclick="@command('update') @validator('eventvalidator.dishvalidator')"/> <button id="delete" label="delete" onclick="@command('delete') @validator('eventvalidator.dishvalidator')"/> </hlayout> </groupbox>

and error is

org.hibernate.propertyvalueexception: not-null property references null or transient value : model.dish.price

and code functions right is:

<groupbox id="mygrp" form="@id('dish') @load(vm.selecteddish) @save(vm.selecteddish, before='update') @save(vm.newdish, before='add')"> <caption label=" dish " /> title: <textbox id="dishtitle" cols="25" value="@bind(dish.title)" /> <div> price: <decimalbox id="dishprice2" format="#,###.##" cols="10" hflex="min" value="@bind(dish.price)" /> </div> <hlayout> <button id="add" label="add" onclick="@command('add') @validator('eventvalidator.dishvalidator')" /> <button id="update" label="update" onclick="@command('update') @validator('eventvalidator.dishvalidator')" /> <button id="delete" label="delete" onclick="@command('delete') @validator('eventvalidator.dishvalidator')" /> </hlayout> </groupbox>

im unable coprehend how rid of form without loosing @load , @save

well reply is:

<groupbox id="mygrp"> <caption label=" dish " /> title: <textbox id="dishtitle" cols="25" value="@load(vm.selecteddish.title) @save(vm.selecteddish.title, before='update') @save(vm.newdish.title, before='add')" /> <div> price: <decimalbox id="dishprice2" format="#,###.##" cols="10" hflex="min" value="@load(vm.selecteddish.price) @save(vm.selecteddish.price, before='update') @save(vm.newdish.price, before='add')" /> </div> <hlayout> <button id="add" label="add" onclick="@command('add') @validator('eventvalidator.dishvalidator')" /> <button id="update" label="update" onclick="@command('update') @validator('eventvalidator.dishvalidator')" /> <button id="delete" label="delete" onclick="@command('delete') @validator('eventvalidator.dishvalidator')" /> </hlayout> </groupbox>

finnaly found proper documentation on property binding

hibernate zk

No comments:

Post a Comment