Hey,
I got a problem with the mapping between 2 tables with foreign keys. The tables are:
CustomerOrder
-----------------
private Date createDate;
private Date deliveryDate;
private int price;
private int freightCost;
private int status;
private int paymentMode;
private int totalVolume;
private int totalWeight;
private int totalCost;
private int versionNo;
private CompositeCustOrdLinesID compOrderLineID;
CustomerOrderLine
----------------------
private String articleNo;
private String articleName;
private int quantity;
private int price;
private int volume;
private int weight;
private int deliveryDate;
private CompositeCustOrdLinesID compOrderLineID;
CompositeCustOrdLinesID (my key class holding the foreign keys)
------------------------------
private String countryCode; (CustomerOrder & CustomerOrderLine)
private String customerOrderNo; (CustomerOrder & CustomerOrderLine)
private String orderLineNo; (CustomerOrderLine)
private int mHashCode = -1;
The XML-file for the keys looks like this:
<hibernate-mapping>
<class name="net.sf.hibernate.CompositeCustOrdLinesID" table="COMPOSITECUSTORDLINES_T">
<composite-id>
<key-many-to-one name="countryCode" column="COUNTRYCODE" class="net.sf.hibernate.CustomerOrder"/>
<key-many-to-one name="customerOrderNo" column="CUSTOMERORDERNO" class="net.sf.hibernate.CustomerOrder"/>
< <key-property name="orderLineNo" column=ORDERLINENO type="string"/>
</composite-id>
</class>
Now, when I run my main it generate the following mapping fault.
12:01:17,788 ERROR XMLHelper:48 - Error parsing XML: XML InputStream(11) The content of elements must consist of well-formed character data or markup. 12:01:17,804 ERROR Configuration:292 - Could not configure datastore from input stream org.dom4j.DocumentException: Error on line 11 of document : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup. at org.dom4j.io.SAXReader.read(SAXReader.java:355) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283) at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333) at net.sf.hibernate.TestCustOrdOrderLines.configure(TestCustOrdOrderLines.java:24) at net.sf.hibernate.TestCustOrdOrderLines.main(TestCustOrdOrderLines.java:130) Nested exception: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup. at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.dom4j.io.SAXReader.read(SAXReader.java:339) at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:283) at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:333) at net.sf.hibernate.TestCustOrdOrderLines.configure(TestCustOrdOrderLines.java:24) at net.sf.hibernate.TestCustOrdOrderLines.main(TestCustOrdOrderLines.java:130) Funkar ej. ERROR = net.sf.hibernate.MappingException: Error reading resource: net/sf/hibernate/CompositeCustOrdLinesID.hbm.xml
Has anyone an idea how I'm gonna solve this? I don't get how to fix it.
Br. Johan
|