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.  [ 2 posts ] 
Author Message
 Post subject: Mapped component-id broken in 3.1.1, OK in 3.1 final
PostPosted: Mon Mar 06, 2006 12:07 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
In 3.1 final I was using the following with success:

class to be used as mapped component-id:
Code:
public class HistoryId implements Serializable {
    private Object id;
    private Date validFrom;

... equals() and hashCode()
... getters and setters
}


relevant mapping document part:
Code:
    <class name='AbstractBenchmark' entity-name='com.csg.pmnet.se.model.AbstractBenchmarkHistory'
        table='se_benchmark_hist'>
        <composite-id mapped="true" class="com.csg.pmnet.model.HistoryId">
            <key-property name="id" type="long"/>
            <key-property name="validFrom" type="imm_timestamp" />
        </composite-id>
.... rest omitted

I don't think the fact that I use an alternative entity name here is relevant, but I didn't try it out.

Now I execute the following HQL query:
Code:
from com.csg.pmnet.se.model.BenchmarkHistory where id = :id and validFrom <= :date and :date < validTo

Note: I'm not really using the composite-id here (i.e. not using session.get(AbstractBenchmark.class, new HistoryId(x,y)), but simply executing a query.

In 3.1 final all is OK, but in 3.1.1 and later I get an error:
Quote:
org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.csg.pmnet.model.HistoryId.id
.

Debugging into Hibernate, I notice that in org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValue (line 121 in version 3.1.2):
Code:
   public Object getPropertyValue(Object component, int i)

   throws HibernateException {

      return getters[i].get( component );

   }


The getter for field "id" is no longer called for a component of type HistoryId, but for a "component" of type Long. So instead getting the field calling HistoryId.id (correct) it tries to fetch the field Long.id, which obviously fails.

I strongly suspect a new bug here and have downgraded to version 3.1 final for the time being.

Am I using the mapped composite-id wrongly, or do we really have a bug here?

Edited, appended: no answers yet, should I file a bug in JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 5:52 pm 
Newbie

Joined: Thu Apr 15, 2004 4:31 pm
Posts: 7
I am having the same problem. If you could post a jira issue it would be most helpfull.


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