Announcement Announcement Module
No announcement yet.
one-to-one mapping Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • one-to-one mapping

    Hello All,

    one-to-one mapping not working

        <class name="com.example.A" table="TAB_A">
        	<id name="id" type="java.lang.Long">
                <column name="ID" />
            <one-to-one name="item" class="com.example.LineItem" />
    Class A
    public class A  implements
    	Long id;
    	LineIten item
    	...<getter setter>
    public class LiteItem  implements
    	Long id;
    	...<getter setter>
    I am calling save from Spring layer using getHibernateTemplate().saveOrUpdate( a ); This throws exception
    java.sql.BatchUpdateException: ORA-01400: cannot insert NULL

    I saw the insert and I noticed that it is not including item (item_id) in the insert statement generated.

    Any idea whats going wrong here.


  • #2
    pk in TAB_A is with column ID

    and in LineItem its with column name ID.

    Will this be an issue?

    property reference in class can be different than column key and I guess that should not be the problem. Please let me know if that is wrong
    Last edited by springnewbie; Dec 29th, 2008, 11:05 PM.