-->
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.  [ 1 post ] 
Author Message
 Post subject: Nullability check in dynamic update
PostPosted: Fri Oct 13, 2006 5:48 am 
Newbie

Joined: Tue Apr 25, 2006 9:49 am
Posts: 9
I'm trying to partial update few properties of entity.
I hafe defined dynamic-update="true" for entity and implemented findDirty function of interceptor, wich returns only updateted properties indexes.

The problem is that when nullability is cheked, it's checked for ALL properties, and not only for dirty properties. Isn't it bug in DefaultFlushEntityEventListener ?
How do i overcone this problem ?



Hibernate version:3.2

Mapping documents:


<hibernate-mapping>
<class name="com.unilims.academic.pojo.Clients" table="clients" catalog="academic" dynamic-update="true">
<id name="clientId" type="integer">
<column name="ClientID" />
<generator class="identity" />
</id>
.......
<property name="clientNameLat" type="string">
<column name="ClientNameLat" length="50" />
</property>
<property name="clientIsCanceled" type="boolean" >
<column name="ClientIsCanceled" not-null="true" />
</property>
.....
</class>
Code between sessionFactory.openSession() and session.close():
Clients client = new Clients();
client.setClientId(new Integer(3556));
client.setClientNameLat("Name7");
clientsManager.saveOrUpdate(client);
Full stack trace of any exception that occurs:

org.springframework.orm.hibernate3.HibernateSystemException: not-null property references a null or transient value: com.unilims.academic.pojo.Clients.clientIsCanceled; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.unilims.academic.pojo.Clients.clientIsCanceled
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.unilims.academic.pojo.Clients.clientIsCanceled
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:263)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:121)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1178)
at $Proxy1.flush(Unknown Source)
at com.unilims.academic.dao.utils.AcademicHibernateDaoSupport$3.doInHibernate(AcademicHibernateDaoSupport.java:76)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
at com.unilims.academic.dao.utils.AcademicHibernateDaoSupport.saveOrUpdate(AcademicHibernateDaoSupport.java:72)
at com.unilims.academic.manager.AcademicManager.saveOrUpdate(AcademicManager.java:38)
at com.unilims.academic.manager.clientsManager.ClientsManager.saveOrUpdate(ClientsManager.java:17)
at test.ClientsManagerTest.testUpdateClient(ClientsManagerTest.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


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

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.