Results 1 to 2 of 2
  1. #1
    rockeymen is offline Member
    Join Date
    Aug 2011
    Rep Power

    Default 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 = 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
    at org.springframework.orm.hibernate3.HibernateAccess or.convertHibernateAccessException(HibernateAccess
    at org.springframework.orm.hibernate3.HibernateTempla te.execute(
    at org.springframework.orm.hibernate3.HibernateTempla te.execute(
    at com.tudou.tudouadsales.component.dao.BaseDaoHibern ate.findByQueryUniqueResult( 347)
    at com.tudou.tudouadsales.plantable.dao.impl.OrdersDa oHibernate.getOrdersListByRelatedOrdersId(OrdersDa
    at com.tudou.tudouadsales.plantable.service.impl.Orde rsServiceImpl.CalculateOrders(OrdersServiceImpl.ja va:346)
    at com.tudou.tudouadsales.plantable.service.impl.Orde rsServiceImpl.updateOrders( 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)
    private Orders orders;

    in mysql: orders_product_item has the column: orders_id

    So, what is wrong with the hql code???

    thanks a lot!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. Strange behaviour
    By imadabh in forum Threads and Synchronization
    Replies: 1
    Last Post: 05-11-2011, 04:31 PM
  2. Strange for loop
    By Grimmjow in forum New To Java
    Replies: 5
    Last Post: 01-23-2011, 11:52 PM
  3. strange outcome!
    By consurgens in forum New To Java
    Replies: 6
    Last Post: 08-20-2010, 10:36 AM
  4. strange swt exception
    By ahmed.kotb in forum SWT / JFace
    Replies: 0
    Last Post: 04-23-2009, 11:15 AM
  5. Strange problem
    By Tamir in forum Eclipse
    Replies: 1
    Last Post: 08-18-2008, 10:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts