-->
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.  [ 4 posts ] 
Author Message
 Post subject: Issue with mapping of <any> type
PostPosted: Thu May 20, 2004 9:06 am 
Newbie

Joined: Fri Mar 05, 2004 4:53 am
Posts: 5
Location: Beijing
Guys, i used hibernate 2.1.1 in the project.
here is the code and the mapping

Code:
class PlanItem {
   //...there are some other properties and getters/setters

   private List loggedDataList;

   public List getLoggedDataList() {return this.loggedDataList;}
   public void setLoggedDataList(list) {this.loggedDataList = list;}
}


class NoticeItem {
   //...there are some other properties and getters/setters

   private List loggedDataList;

   public List getLoggedDataList() {return this.loggedDataList;}
   public void setLoggedDataList(list) {this.loggedDataList = list;}
}


class LoggedData {
   private String      loggedDataId;
   private Date      logDateTime;
   private DateSpan      dateSpan;
   private Integer      quantity;
   private Integer       loggedDataSeqId;
   private Object       referencedEntity;
   

   
   public DateSpan getDateSpan() {
      return dateSpan;
   }

   public void setDateSpan(DateSpan dateSpan) {
      this.dateSpan = dateSpan;
   }

   public String getLoggedDataId() {
      return loggedDataId;
   }

   public void setLoggedDataId(String loggedDataId) {
      this.loggedDataId = loggedDataId;
   }

   public Integer getQuantity() {
      return quantity;
   }

   public void setQuantity(Integer quantity) {
      this.quantity = quantity;
   }

   /**
    * @return Returns the loggedDataSeqId.
    */
   public Integer getLoggedDataSeqId() {
      return loggedDataSeqId;
   }

   /**
    * @param loggedDataSeqId The loggedDataSeqId to set.
    */
   public void setLoggedDataSeqId(Integer loggedDataSeqId) {
      this.loggedDataSeqId = loggedDataSeqId;
   }

   public Object getReferencedEntity() {
      return this.referencedEntity;
   }

   public void setReferencedEntity(Object referencedEntity) {
      this.referencedEntity = referencedEntity;
   }

   public Date getLogDateTime() {
      return this.logDateTime;
   }

   public void setLogDateTime(Date logDateTime) {
      this.logDateTime = logDateTime;
   }
}



<class name="eg.PlanItem" table="PLAN_ITEM" dynamic-update="false" lazy="true">
   <!--some properties-->
   <list name="loggedDataList" lazy="true" inverse="true" cascade="all" outer-join="false">
      <key column="REFERENCED_ID"/>
      <index column="LOGGED_DATA_SEQ_ID"/>
      <one-to-many class="eg.LoggedData"></one-to-many>
   </list>
</class>



<class name="eg.NoticeItem" table="NOTICE_ITEM" dynamic-update="false" lazy="true">
   <!--some properties-->
   <list name="loggedDataList" lazy="true" inverse="true" cascade="all" outer-join="false">
      <key column="REFERENCED_ID"/>
      <index column="LOGGED_DATA_SEQ_ID"/>
      <one-to-many class="eg.LoggedData"/>
   </list>
</class>



<class name="eg.LoggedData" table="LOGGED_DATA" dynamic-update="false" lazy="true">
   <id name="loggedDataId" column="LOGGED_DATA_ID" type="string" length="20" unsaved-value="any">
      <generator class="native"/>
   </id>
   <property name="loggedDataSeqId" column="LOGGED_DATA_SEQ_ID" type="integer" />
   <property name="logDateTime" type="timestamp" column="LOG_DATE_TIME" insert="true" update="true"/>
   <component name="dateSpan" class="eg.DateSpan">
      <many-to-one name="dateSpanType" class="eg.DateSpanTypeEntity" cascade="none" outer-join="false" update="true" insert="true" column="DATE_SPAN_TYPE_ID"/>
      <property name="dateTimeFrom" type="timestamp" update="true" insert="true" column="DATE_TIME_FROM"/>
      <property name="dateTimeTo" type="timestamp" update="true" insert="true" column="DATE_TIME_TO"/>
   </component>
   <property name="quantity" type="java.lang.Integer" update="true" insert="true" column="QUANTITY"/>
         
   <any id-type="string" name="referencedEntity">
      <column name="REFERENCED_CLASS"/>
      <column name="REFERENCED_ID"/>
   </any>
</class>



Then, suppose we have one record of PlanItem which id is "1" and another record of NoticeItem which id has the same value of "1", and there are varies entity records of LoggedData class for each one 'Item', then everytime i called the method getLoggedDataList in PlanItem class, the LoggedData records which related with the NoticeItem will be fetched too.

How can i get the correct list of loggedData?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 7:38 pm 
Newbie

Joined: Fri Mar 05, 2004 4:53 am
Posts: 5
Location: Beijing
anybody could help me please?
I am using Oracle9i as the database


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 1:21 pm 
Newbie

Joined: Fri Mar 05, 2004 4:53 am
Posts: 5
Location: Beijing
anybody have any suggestion?
or maybe what i said is not clear enough yet?


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 23, 2004 8:01 pm 
Newbie

Joined: Fri Mar 05, 2004 4:53 am
Posts: 5
Location: Beijing
please, i have no idea about the mechnism of hibernate implementation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.