hey,
i'm lost at how to map these classes. on my JSP page i have, i call the List<Invoice> invoices and use the JSTL tag <c:forEach> to access each Invoice object in the invoices List. two of the columns in my Invoice object are mailedtoContactID and invoiceContactID.
the second class is Contact and its contactID column is what i would like mapped to the two previously mentioned columns in Invoice.
here are my two mapping files:
Code:
<hibernate-mapping>
<class name="model.Invoice" table="Invoices">
<id name="invoiceID" column="InvoiceID"/>
<property name="mailedtoContactID" column="MailedtoContactID"/>
<property name="invoiceContactID" column="InvoiceContactID"/>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping>
<class name="model.Contact" table="Contacts">
<id name="contactID" column="ContactID"/>
<property name="name" column="Name"/>
</class>
</hibernate-mapping>
in my Invoice.java and Contact.java files a have the default constructor and instances of all columns plus an instance of a Contact object in Invoice.java and an Invoice object in Contact.java with all their accessors and mutators.
Invoice.MailedtoContactID can be the same as Invoice.InvoiceContactID and they can each be in more than one Invoice.
this is part of my JSP page:
Code:
<c:forEach items="${invoices}" var="invoice">
<c:out value="${invoice.invoiceID}"/>
</c:forEach>
how would i be able to reference something like ${invoice.invoiceContactID.name} ??
thanks for any help!