Results 1 to 2 of 2
- 08-26-2011, 04:33 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 1
- Rep Power
- 0
a strange BUG when using Hql : DataIntegrityViolationExcept
Many thanks if who can help to find the reason, it has bothered me for a long time.
I am using hibernate to access mysql.
and using following hql:
select productItem from OrdersProductItem productItem where productItem.orders.id = 11
and an exception popped up:
not-null property references a null or transient value: com.tudou.tudouadsales.plantable.entity.OrdersProd uctItem.orders; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: com.tudou.tudouadsales.plantable.entity.OrdersProd uctItem.orders
the call stack is:
at org.springframework.orm.hibernate3.SessionFactoryU tils.convertHibernateAccessException(SessionFactor yUtils.java:628)
at org.springframework.orm.hibernate3.HibernateAccess or.convertHibernateAccessException(HibernateAccess or.java:412)
at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:378)
at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:338)
at com.tudou.tudouadsales.component.dao.BaseDaoHibern ate.findByQueryUniqueResult(BaseDaoHibernate.java: 347)
at com.tudou.tudouadsales.plantable.dao.impl.OrdersDa oHibernate.getOrdersListByRelatedOrdersId(OrdersDa oHibernate.java:243)
at com.tudou.tudouadsales.plantable.service.impl.Orde rsServiceImpl.CalculateOrders(OrdersServiceImpl.ja va:346)
at com.tudou.tudouadsales.plantable.service.impl.Orde rsServiceImpl.updateOrders(OrdersServiceImpl.java: 467)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
Here , the define of OrdersProductItem and orders is:
class Orders{
integer id; //not null
...
...
}
in mysql: orders has the column: id
class OrdersProductItem {
@ManyToOne(fetch = FetchType.LAZY)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@JoinColumn(name="orders_id",nullable=false)
private Orders orders;
}
in mysql: orders_product_item has the column: orders_id
So, what is wrong with the hql code???
thanks a lot!
- 08-26-2011, 07:01 AM #2
Similar Threads
-
Strange behaviour
By imadabh in forum Threads and SynchronizationReplies: 1Last Post: 05-11-2011, 03:31 PM -
Strange for loop
By Grimmjow in forum New To JavaReplies: 5Last Post: 01-23-2011, 10:52 PM -
strange outcome!
By consurgens in forum New To JavaReplies: 6Last Post: 08-20-2010, 09:36 AM -
strange swt exception
By ahmed.kotb in forum SWT / JFaceReplies: 0Last Post: 04-23-2009, 10:15 AM -
Strange problem
By Tamir in forum EclipseReplies: 1Last Post: 08-18-2008, 09:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks