-->
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.  [ 3 posts ] 
Author Message
 Post subject: Referencing an interface in a mapped Set
PostPosted: Mon Aug 01, 2005 5:55 pm 
Newbie

Joined: Mon Aug 01, 2005 5:47 pm
Posts: 4
Location: Austin, TX, USA
Explanation at bottom...

Hibernate version:

3.0.5

Mapping documents:

<class mutable="false" name="Lot" table="frlot">
<id name="id" column="lot_id" />
<property name="type" column="lot_type" />
<property name="subType" column="sub_lot_type" />
<property name="status" column="lot_process_state" />
<property name="state" column="lot_state" />
<property name="productionState" column="lot_prodctn_state" />
<property name="holdState" column="lot_hold_state" />
<property name="finishedState" column="lot_finished_state" />
<property name="inventoryState" column="lot_inv_state" />
<property name="priority" column="priority_class" />
<property name="externalPriority" column="priority" />
<property name="totalWaferQuantity" column="qty" />
<property name="productWaferQuantity" column="prod_qty" />
<property name="controlWaferQuantity" column="cntl_qty" />
<property name="processLagTime" column="process_lag_time" />
<property name="lastClaimTime" column="claim_time" type="com.amd.fabview.siview.hibernate.TimestampType" />
<property name="bankId" column="bank_id" />
<property name="parentLotId" column="split_lot_id" />
<property name="vendorLotId" column="vendor_lot_id" />
<property name="lastClaimUser" column="claim_user_id" />
<property name="createdTime" column="created_time" type="com.amd.fabview.siview.hibernate.TimestampType" />
<property name="activatedTime" column="activated_time" type="com.amd.fabview.siview.hibernate.TimestampType" />
<property name="releasedTime" column="released_time" type="com.amd.fabview.siview.hibernate.TimestampType" />
<property name="queuedTime" column="queued_time" type="com.amd.fabview.siview.hibernate.TimestampType" />
<set name="notesOrComments">
<key column="Lot_ID"/>
<one-to-many class="LotNoteOrComment"/>
</set>
</class>


Code between sessionFactory.openSession() and session.close():

Is not reached in this case.

Full stack trace of any exception that occurs:

Association references unmapped class: com.amd.fabview.siview.hibernate.LotNoteOrComment
at com.amd.fabview.siview.hibernate.HibernateFactory.getInstance(HibernateFactory.java:151)
at com.amd.fabview.siview.hibernate.HibernateFactory.getInstance(HibernateFactory.java:128)
at com.amd.fabview.siview.hibernate.HibernateFactory.getInstance(HibernateFactory.java:101)
at com.amd.fabview.siview.lot.LotOperationTransaction.getLotOperationSummaryCriteria(LotOperationTransaction.java:301)
at com.amd.fabview.siview.lot.LotOperationBuilder.getLotOperationEvents(LotOperationBuilder.java:405)
at com.amd.fabview.siview.lot.LotOperationBuilder.buildSummaryDataset(LotOperationBuilder.java:319)
at com.amd.fabview.siview.lot.LotOperationBuilder.generateHTMLOperationSummaryList(LotOperationBuilder.java:200)
at com.amd.fabview.siview.lot.LotHistoryFacade.generateHTMLOperationSummaryList(LotHistoryFacade.java:139)
at org.apache.jsp.jsp.com.amd.fabview.siview.lot.LotHistorySummary_jsp._jspService(org.apache.jsp.jsp.com.amd.fabview.siview.lot.LotHistorySummary_jsp:965)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:673)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:464)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:691)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:658)
at org.apache.jsp.jsp.com.amd.fabview.siview.CheckLot_jsp._jspService(org.apache.jsp.jsp.com.amd.fabview.siview.CheckLot_jsp:173)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

Name and version of the database you are using:

Oracle 8i

The generated SQL (show_sql=true):

Not applicable in this case.

Debug level Hibernate log excerpt:

- processing extends queue
- processing collection mappings
- Mapping collection: com.amd.fabview.siview.hibernate.Equipment.chambers -> frprcrsc
- Servlet.service() for servlet jsp threw exception
com.amd.fabview.FabviewException: Association references unmapped class: com.amd.fabview.siview.hibernate.LotNoteOrComment
... (as above)

Explanation:

Basically, we have two classes - LotNote and LotComment. Both implement the interface LotNoteOrComment. We're trying to may a SortedSet from the Lot class to this LotNoteOrComment interface. I can quite successfully create a Session query against the interface, so I know that the two classes are mapped correctly and that they are both implementing the interface as designed. How can I teach Hibernate about this method without adding the Interface to the mapping file? Or is there a way to do so without losing the ability to cast to a more specific class?

These two classes are almost identical in structure, but are loaded from two different tables. Most code wants to see a sorted set interleaving both of them, and just uses the common methods, hence the interface.

Any assistance will be much appreciated.

-Richard Stanford


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 4:54 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
I think you can have a abstract class LotNoteOrComment and both LotNote and LotComment extend from this class.

Then you can have a mapping like:

<class name = LotNoteOrComment ... discriminator = -1>

<discriminator column="Lot_Type_Code" />
.....
<set name="notesOrComments">
<key column="Lot_ID"/>
<one-to-many class="LotNoteOrComment"/>
</set>

<!-- Mapping for subclasses -->
<subclass name="LotNote" discriminator-value="1">

</subclass>

<subclass name="LotComment" discriminator-value="2">

</subclass>
</class>

I haven't tried this out, but i think this should work for you.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 6:37 am 
Newbie

Joined: Mon Aug 01, 2005 5:47 pm
Posts: 4
Location: Austin, TX, USA
Thanks, but I'm not sure that will work for us. I should have been a little more specific - something I forgot to say explicitly was that these two classes, while they share a common implementation, are each mapped to a completely different table on the database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.