-->
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: [Mapping XML] composite-id
PostPosted: Thu Sep 08, 2005 10:27 am 
Newbie

Joined: Thu Sep 08, 2005 10:04 am
Posts: 1
Hi,

First of all, sorry for my english

I'm using hibernate with XML mapping file.

here is my liv.hbmxml :
Code:
<hibernate-mapping package="client">
<class name="liv" table="JLIV" node ="jiv">
  <composite-id name="id" class="JLivKey" node="@id">
    <key-many-to-one name="compte" column="CPT_CODE" class="Compte"/>
    <key-property name="livDateeffet" column="LIV_DATEEFFET" type="java.util.Date"/>
   </composite-id>

   <property name="livLun" column="LIV_LUN" type="java.lang.Byte"  not-null="true" node = "livLun"/>
   <property name="livMar" column="LIV_MAR" type="java.lang.Byte"  not-null="true" node = "livMar"/>
    </class>
</hibernate-mapping>


i'm trying to save something in the table but it does not work.

Here is my code :
Code:
Session session = HibernateUtil.getSession();
Session xmlSession = session.getSession(EntityMode.DOM4J);
HibernateUtil.beginTransaction();
Document documentStructure = new SAXReader().read(new File("C:/test.xml"));
Element element = (Element)documentStructure.getRootElement();
xmlSession.save("Client.liv",element);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();


HibernateUtil is a factory for all the commom function of hibernate.


Here is my XML file
Code:
<jliv id="">
   <livLun>0</livLun>
   <livMar>0</livMar>
</liv>



So my problem is to have a match between a node (or an attribute) in my XML file and my XML mapping. I can't find the way to solve this problem.

Please help me

Thanks


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.