-->
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.  [ 5 posts ] 
Author Message
 Post subject: Behavior of Nullability.checkNullability
PostPosted: Tue Aug 02, 2016 5:49 am 
Newbie

Joined: Tue Aug 02, 2016 5:46 am
Posts: 3
I have a question about a behavior of Nullability.checkNullability(Nullability.java:100).

I set constraints of not-null in both oracle table settings and hibernate mapping settings.
Exaplme of hibernate mapping setting is below.
<hibernate-mapping schema="DUMMY" package="com.xxx.bbb.dataAccess">
<class name="JobDataPac" table="JD_PAC">
<many-to-one name="jobData"
column="JP_ID"
not-null="true"
class="com.xxx.bbb.JobData">
</many-to-one>
</class>
</hibernate-mapping>

I don't set hibernate.check_nullability and it should behave as default.
I believe that even if I set constraints of not-null to some columns by
hibernate mapping settings, hibernate.check_nullability should be set false
as default, so Nullability.checkNullability() should not be worked. And
in my development environment, it does so.
However in customer environment, Nullability.checkNullability() is worked
unfortunitely.

Is the default of hibernate.check_nullability changed by environment dependency
and does it change the behavior of Nullability.checkNullability()?
What should I check in customer environment?

Version
hibernate-core-3.6.10
spring-framework-3.2.8


StackTrace
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.bbb.dataAccess.JobDataPac.jobData
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:100)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:312)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:143)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:252)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:392)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:335)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:425)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:362)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:338)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:204)
at org.hibernate.engine.Cascade.cascade(Cascade.java:161)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:154)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:145)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at org.springframework.orm.hibernate3.HibernateTemplate$28.doInHibernate(HibernateTemplate.java:884)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:407)
... 23 more


Top
 Profile  
 
 Post subject: Re: Behavior of Nullability.checkNullability
PostPosted: Tue Aug 02, 2016 7:16 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
According to our docs:

Quote:
Default to `false` if Bean Validation is present in the classpath and Hibernate Annotations is used, `true` otherwise.


So, it might be that your customer does not have the Bean Validation dependency on the classptah.


Top
 Profile  
 
 Post subject: Re: Behavior of Nullability.checkNullability
PostPosted: Wed Aug 03, 2016 9:32 pm 
Newbie

Joined: Tue Aug 02, 2016 5:46 am
Posts: 3
Hi mihalcea_vlad,
Thank you for quick response.
I checked the customer site then I found that they use OpenJDK instead of Java JDK. I'm trying to reproduce it in my test environment by installing OpenJDK. Do you think it is root cause?


Top
 Profile  
 
 Post subject: Re: Behavior of Nullability.checkNullability
PostPosted: Thu Aug 04, 2016 3:03 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I don't think so, but it's worth checking.


Top
 Profile  
 
 Post subject: Re: Behavior of Nullability.checkNullability
PostPosted: Thu Aug 04, 2016 10:33 pm 
Newbie

Joined: Tue Aug 02, 2016 5:46 am
Posts: 3
Hi mihalcea_vlad,
Thank you for quick response.

I installed the Open JDK.
It has been changed to Open JDK.
>sudo update-alternatives --config java

But the situation did not change.
Try to check the boot configuration of JBOSS.

Program architecture
JBOSS AS7
Hibernate
Spring
Struts


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.