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: need help with mapping
PostPosted: Wed Aug 08, 2007 5:30 pm 
Newbie

Joined: Thu Aug 02, 2007 2:02 pm
Posts: 5
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!


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.