It sounds like you're telling Hibernate that the brandName must not be null and then not setting it before saving. Can we see the code which generates the attached stack trace to confirm this?
Up vote 0 down vote favorite share g+ share fb share tw.
I am new to hibernate and trying to create a hibernate file for this table: brand_id | brand_name | status int,PK,AI varchar(100) | bool My hibernate file is: when set not-null property of brandName to true, I got exception following exception: org.hibernate. PropertyValueException: not-null property references a null or transient value: com.bla.pojos.Brand. Status at org.hibernate.engine.Nullability.
CheckNullability(Nullability. Java:72) at org.hibernate.event.def. AbstractSaveEventListener.
PerformSaveOrReplicate(AbstractSaveEventListener. Java:290) at org.hibernate.event.def. AbstractSaveEventListener.
PerformSave(AbstractSaveEventListener. Java:181) at org.hibernate.event.def. AbstractSaveEventListener.
SaveWithGeneratedId(AbstractSaveEventListener. Java:107) at org.hibernate.event.def. DefaultSaveOrUpdateEventListener.
SaveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener. Java:187) at org.hibernate.event.def. DefaultSaveEventListener.
SaveWithGeneratedOrRequestedId(DefaultSaveEventListener. Java:33) at org.hibernate.event.def. DefaultSaveOrUpdateEventListener.
EntityIsTransient(DefaultSaveOrUpdateEventListener. Java:172) at org.hibernate.event.def. DefaultSaveEventListener.
PerformSaveOrUpdate(DefaultSaveEventListener. Java:27) at org.hibernate.event.def. DefaultSaveOrUpdateEventListener.
OnSaveOrUpdate(DefaultSaveOrUpdateEventListener. Java:70) at org.hibernate.impl.SessionImpl. FireSave(SessionImpl.
Java:535) at org.hibernate.impl.SessionImpl. Save(SessionImpl. Java:523) at org.hibernate.impl.SessionImpl.
Save(SessionImpl. Java:519) When I set it to false or wrote nothing there, I am saving my data with null value. What am I doing wrong?
EDIT: Backing Bean: @ManagedBean(name="brandSettingsBean") @ViewScoped public class BrandSettingsBean extends EBSBean implements Serializable { BrandSettingsService bsService = new BrandSettingsService(); private Brand brand=new Brand(); private String brandName; private Brand selectedBrand; private List BrandList; public Brand getSelectedBrand() { return selectedBrand; } public void setSelectedBrand(Brand selectedBrand) { this. SelectedBrand = selectedBrand; } public BrandSettingsBean() throws Exception { brandList=bsService. GetBrands(null); } public void brandKaydet() { EBSResponse er = kiService.
BrandKaydet(brand, sessionUser, ipAdresi); if (er. GetExceptionValue() == null) { this. BrandList = (List)er.getObjectValue(); FacesMessage message = new FacesMessage(FacesMessage.
SEVERITY_INFO, localeBean.lang. GetString(er.getStringValue()), ""); FacesContext. GetCurrentInstance().
AddMessage("sysMsg", message); } else { FacesMessage message = new FacesMessage(EBSUtils. GetHataTipi(er. GetExceptionValue().getHataTipi()), localeBean.lang.
GetString(er. GetExceptionValue().getHataMesaji()), ""); FacesContext. GetCurrentInstance().
AddMessage("sysMsg", message); } brand=new Brand(); } xhtml: hibernate hibernate-mapping link|improve this question edited Dec 26 '11 at 15:33Alex1,676413 asked Dec 26 '11 at 11:47lamostreta1547 65% accept rate.
I added the xhtml and backing bean codes. – lamostreta Dec 26 '11 at 12:34 Hmm, I'm not sure what's going on there. Hibernate references the status field.
Have you got a property called status on Brand? – Alex Dec 26 '11 at 14:50 Alex, thanks for your answer. I have found out that I am sending the brandName to the backing bean, instead I should've sent brand.
– lamostreta Dec 28 '11 at 10:28.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.