-->
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.  [ 5 posts ] 
Author Message
 Post subject: problem in one-to-many mapping
PostPosted: Mon Mar 31, 2008 12:36 pm 
Newbie

Joined: Fri Nov 16, 2007 3:05 pm
Posts: 14
Hi Guys,

I getting the following exception:
org.hibernate.PropertyAccessException: exception getting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) getter of com.hibernate.poc.MeetingKey.?

when i try to run this code
Property keyProperty = Property.forName("key");
Meeting gp = (Meeting)ses.createCriteria(Meeting.class)
.setFetchMode("chronologyTextValues",FetchMode.JOIN)
.add(keyProperty.getProperty("caseId").eq("WAK"))
.add(keyProperty.getProperty("eventSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("groupSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("participantId").eq(new Integer(220)))
.add(keyProperty.getProperty("meetingSeq").eq(new Integer(2)))
.uniqueResult();

can any one please help me out.


Hibernate version: Hibernate 3.1.2

Mapping documents:
<class name="Meeting" table="meeting">
<composite-id name="key" class="MeetingKey">
<key-property name="caseId" column="case_id"/>
<key-property name="eventSeq" column="event_seq"/>
<key-property name="groupSeq" column="group_seq"/>
<key-property name="participantId" column="participant_id"/>
<key-property name="meetingSeq" column="meeting_seq"/>
</composite-id>

<property name="name" column="meeting_title"/>
<property name="meetingDate" column="meeting_date"/>
<property name="time" column="time_of_day"/>

<set name="chronologyTextValues" inverse="true">
<key column="text_id" property-ref="descriptionId"/>
<one-to-many class="ChronologyText"/>
</set>

<property name="descriptionId" column="description_text_id" unique="true"/>
</class>

<class name="ChronologyText" table="chronology_text">

<composite-id name="key" class="ChronologyTextKey">
<key-property name="textId" column="text_id"/>
<key-property name="sequenceNum" column="sequence_num"/>
</composite-id>

<!--
<id name="textId" column="text_id">
<generator class="assigned"></generator>
</id>
<property name="sequenceNum" column="sequence_num"></property>
-->
<many-to-one name="meeting" column="text_id" property-ref="descriptionId" insert="false" update="false"></many-to-one>
<property name="textValue" column="text_value" />
</class>



Code between sessionFactory.openSession() and session.close():
Property keyProperty = Property.forName("key");
Meeting gp = (Meeting)ses.createCriteria(Meeting.class)
.setFetchMode("chronologyTextValues",FetchMode.JOIN)
.add(keyProperty.getProperty("caseId").eq("WAK"))
.add(keyProperty.getProperty("eventSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("groupSeq").eq(new Integer(1)))
.add(keyProperty.getProperty("participantId").eq(new Integer(220)))
.add(keyProperty.getProperty("meetingSeq").eq(new Integer(2)))
.uniqueResult();



Full stack trace of any exception that occurs:
org.hibernate.PropertyAccessException: exception getting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) getter of com.hibernate.poc.MeetingKey.?
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:79)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158)
at org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:69)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:42)
at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:717)
at org.hibernate.engine.CollectionLoadContext.getLoadingCollection(CollectionLoadContext.java:88)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:990)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1552)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:284)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:306)
at com.hibernate.poc.Main.main(Main.java:248)
Caused by: java.lang.ClassCastException: java.lang.Integer
at com.hibernate.poc.MeetingKey$$BulkBeanByCGLIB$$ea426f57.getPropertyValues(<generated>)
at net.sf.cglib.beans.BulkBean.getPropertyValues(BulkBean.java:48)
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:76)



with thanks
krishna


Top
 Profile  
 
 Post subject: problem in one-to-many mapping
PostPosted: Tue Apr 01, 2008 6:09 am 
Newbie

Joined: Fri Nov 16, 2007 3:05 pm
Posts: 14
hi guys,

Can any one please help me.

with thanks,
krishna


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 01, 2008 6:44 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

please send your java files


Top
 Profile  
 
 Post subject: problem in one-to-many mapping
PostPosted: Thu Apr 03, 2008 12:20 pm 
Newbie

Joined: Fri Nov 16, 2007 3:05 pm
Posts: 14
Hi,

Here is my java files, which are related to this issue.

//Meeting Vo Class
public class Meeting extends JFFVOImpl implements Comparable {

protected MeetingKey key; //composite primary key
protected String name;
protected Date meetingDate;
protected String time;
protected String description;
protected long descriptionId;

public long getDescriptionId() {
return descriptionId;
}

public void setDescriptionId(long descriptionId) {
this.descriptionId = descriptionId;
}

public MeetingKey getKey() {
return key;
}

public void setKey(MeetingKey key) {
this.key = key;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Date getMeetingDate() {
return meetingDate;
}

public void setMeetingDate(Date meetingDate) {
this.meetingDate = meetingDate;
}

public String getTime() {
return time;
}

public void setTime(String time) {
this.time = time;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

}

//Composite Id class for meeting
public class MeetingKey implements Serializable{

protected String caseId;
protected int eventSeq;
protected int groupSeq;
protected int participantId;
protected int meetingSeq;

public MeetingKey() {
}

public String getCaseId() {
return caseId;
}
public void setCaseId(String caseId) {
this.caseId = caseId;
}
public int getEventSeq() {
return eventSeq;
}
public void setEventSeq(int eventSeq) {
this.eventSeq = eventSeq;
}
public int getGroupSeq() {
return groupSeq;
}
public void setGroupSeq(int groupSeq) {
this.groupSeq = groupSeq;
}
public int getParticipantId() {
return participantId;
}
public void setParticipantId(int participantId) {
this.participantId = participantId;
}

public int getMeetingSeq() {
return meetingSeq;
}

public void setMeetingSeq(int meetingSeq) {
this.meetingSeq = meetingSeq;
}
}


//This is the Chronology Text Vo
public class ChronologyText extends BaseVOImpl{

private ChronologyTextKey key;//composite primary key
private String textValue;


/**
* @return Returns the textValue.
*/
public String getTextValue() {
return textValue;
}
/**
* @param textValue The textValue to set.
*/
public void setTextValue(String textValue) {
this.textValue = textValue;
}
/**
* @return Returns the key.
*/
public ChronologyTextKey getKey() {
return key;
}
/**
* @param key The key to set.
*/
public void setKey(ChronologyTextKey key) {
this.key = key;
}
}

//Chronology Composite Id class
public class ChronologyTextKey implements Serializable{

private long textId;
private int sequenceNum;

/**
* @return Returns the sequenceNum.
*/
public int getSequenceNum() {
return sequenceNum;
}
/**
* @param sequenceNum The sequenceNum to set.
*/
public void setSequenceNum(int sequenceNum) {
this.sequenceNum = sequenceNum;
}
/**
* @return Returns the textId.
*/
public long getTextId() {
return textId;
}
/**
* @param textId The textId to set.
*/
public void setTextId(long textId) {
this.textId = textId;
}

}

If u need any other info, please let me know.

with thanks
krishna


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 04, 2008 1:13 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

I can't see any set for chronologyTextValues at Metting class. do use any frameworks


Amila
(Don't forget to rate if helps)


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