-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: org.hibernate.PropertyValueException: not-null property refe
PostPosted: Mon Jun 18, 2007 8:02 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
Dear friends,

Please help me to sort out the following problem when I'm tryiing to delete after setting vognum which is the primary key value in Vog table.

"org.hibernate.PropertyValueException: not-null property references a null or transient value: com.DAO.orders.Vog.vogvog"

Details are as follows,

Hibernate version:3.1

Mapping documents:
I've removed some other properties for simplisity

<hibernate-mapping>
<class name="com.DAO.orders.Vog" table="vog" catalog="pao">
<id name="vognum" type="java.lang.Integer">
<column name="VOGNUM" />
<generator class="native" />
</id>
<property name="wmanum" type="java.lang.Integer">
<column name="WMANUM" not-null="true" />
</property>
<property name="vogvog" type="java.lang.Integer">
<column name="VOGVOG" not-null="true" />
</property>

<many-to-one name="bkdkod" class="com.DAO.orders.Bkd" column="bkdkod">
</many-to-one>
<many-to-one name="klanum" class="com.DAO.orders.Kla" property-ref="klanum">
</many-to-one>
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

System.out.println("Inside delete method of order action");
if(request.getParameter("vognum")!= null)
orderno = Integer.parseInt(request.getParameter("vognum"));
System.out.println("ordernum= " + orderno);
Vog lVog= new Vog();
lVog.setVognum(orderno);
ChallengeDao.delete(lVog, request);
System.out.println("Order has been deleted successfully");



Full stack trace of any exception that occurs:

Argh ! Error occurred while deleting object com.DAO.orders.Vog@c95daa:
org.hibernate.PropertyValueException: not-null property references a null or tra
nsient value: com.DAO.orders.Vog.vogvog
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72
)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(Defau
ltDeleteEventListener.java:173)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDe
leteEventListener.java:110)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:761)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:739)
at com.DAO.ChallengeDao.delete(ChallengeDao.java:172)
at com.action.orders.SaveOrderAction.deleteOrder(SaveOrderAction.java:18
2)
at com.action.orders.SaveOrderAction.execute(SaveOrderAction.java:57)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
2)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:256)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:21
1)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:805)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:696)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:677)
at java.lang.Thread.run(Thread.java:595)
Order has been deleted successfully




Name and version of the database you are using:

MySQL5.0


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:07 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi M_GOMATHINAYAGAM,

could you plz.. check that property vogvog whether null or not null.I guess that it comming as null

<property name="vogvog" type="java.lang.Integer">
<column name="VOGVOG" not-null="true" />
</property>

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:14 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
dharmendra.pandey wrote:
Hi M_GOMATHINAYAGAM,

could you plz.. check that property vogvog whether null or not null.I guess that it comming as null

<property name="vogvog" type="java.lang.Integer">
<column name="VOGVOG" not-null="true" />
</property>


Dear dharmendra,

For deleting a partiicular record from vog, I've just set vognum
lVog.setVognum(orderno);

and why should I bother about vogvog ?Its is already set as not null and unique in the database.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:16 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
vognum is not null


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:19 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Dear you have told to hibernate that i will not give null value by defining not-null="true" so hibernate would check it in there session. if it finds it would report not-null property references a null or transient value:

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:25 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
send us hibernate log for deletion after com.DAO.ChallengeDao.delete(ChallengeDao.java:172)

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:28 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
Ok. But can you just tell me how to delete a record in such a situation

1. vognum is the primary key
2. vogvog and wmanum are notnull values which together forms the unique index value.

Please help me..
Prasanth


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 18, 2007 8:38 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
Where can I find hibernate log?

I've already posted the tomcat stacktrace


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 1:57 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
dharmendra.pandey wrote:
send us hibernate log for deletion after com.DAO.ChallengeDao.delete(ChallengeDao.java:172)


Thank you dharmenrda, you are the only person who responded to my query. Anyway I solved the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 1:50 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
hi M_GOMATHINAYAGAM,

If you are able to solve your problem then share it with us so that other would not get stuck with this.I would appreciate if you share it.

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 25, 2007 1:57 am 
Newbie

Joined: Mon Jun 18, 2007 2:29 am
Posts: 16
Hi all,

You are right.I can share the solution for this problem

I'v just set the primary key along with the 2 unique keys I had. That resolved the problem.Previosly as you told, it was trying to set null value to a not-null field.


Thank you


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.