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