• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pls help javax.persistence. PersistenceException: org. hibernate.PropertyValueExc  RSS feed

Val Sw
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a function which adds fields of an entity, when I try to add on update screen it gives the following error, same thing works fine on create screen.

Error message:
16:11:54,908 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2] TwoPhaseCoordinator.beforeCompletion - failed for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@1abb373
javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.entity.Treatment.reagent
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)

a) This link calls quantExperimentHome.addTreatmentLink
<h:commandLink action="#{quantExperimentHome.addTreatmentLink}"
value="Add treatments" immediate="true">
<f aram name="re_hashcode" value="#{info.hashCode()}"/>

quantExperimentHome.addTreatmentLink method
public String addTreatmentLink(){
javax.faces.context.FacesContext facesContext = (new org.jboss.seam.faces.FacesContext()).getContext();
javax.servlet.http.HttpServletRequest hsr=(javax.servlet.http.HttpServletRequest)facesContext.getCurrentInstance().getExternalContext().getRequest();
String reagentHashcode=hsr.getParameter("re_hashcode");
for(int i=0;i<reagent1.length;i++){
reagent1[i].getTreatment().add(new Treatment());
return "added";

b) Entities :
Reagent entity
public class Reagent
implements Equals, HashCode, ToString
protected List<Treatment> treatment;
protected QuantExperiment quantExperiment;

@OneToMany(cascade = {CascadeType.ALL}, mappedBy="reagent")
public List<Treatment> getTreatment() {
if (treatment == null) {
treatment = new ArrayList<Treatment>();
return this.treatment;

public void setTreatment(List<Treatment> treatment) {
for(Treatment t : treatment){
this.treatment = treatment;
public QuantExperiment getQuantExperiment() {
return quantExperiment;

Treatment entity
public class Treatment
implements Equals, HashCode, ToString
protected Reagent reagent;

public Reagent getReagent() {
return reagent;
public void setReagent(Reagent reagent) {
this.reagent = reagent;
Bear Bibeault
Author and ninkuma
Posts: 66207
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Val Sw", please check your private messages for an important administrative matter.

Also, please use real words when posting to the forums. Abbreviations such as "pls" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!