-->
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.  [ 7 posts ] 
Author Message
 Post subject: Object Loading Problem
PostPosted: Wed Dec 03, 2003 12:26 am 
Newbie

Joined: Mon Dec 01, 2003 7:00 am
Posts: 16
Hi ,

Mapping file work fine will inserting and updating the record , but gives problem will retrieving Objects.

Explanation : -

It gives me trouble while loading TCx1PtsiteT object .
1. while loading TA3PatientT object using TCx1PtsiteT object .
Description :-In database Tables TA3PatientT and TCx1PtsiteT have one-to-one relationship on Composite Id.TCx1PtsiteT have many-to-one relationship with TCx1ParticipantM & TCx1PatientT

Here i get the following Exception
SEVERE: IllegalArgumentException in class: .ge.med.registries.acc_30.hibernate.TA3PatientT, getter method of property: participant

In hbm I have defined like this:-

<class name="TCx1PtsiteT" table="T_CX1_PtSite_T">
<composite-id unsaved-value="any" >
<key-many-to-one name="Participant" class="TCx1ParticipantM" column="Participant_ID"/>
<key-many-to-one name="Patient" class="TCx1PatientT" column="PatID"/>
</composite-id>
<one-to-one name="accPatient" class="TA3PatientT" constrained="true" outer-join="false"/>
<bag name="admParticipant" inverse="true" lazy="true" cascade="all">
<key column="Participant_ID"/>
<one-to-many class="TCx1AdmdisT"/>
</bag>
<bag name="admPatient" inverse="true" lazy="true" cascade="all">
<key column="PatID"/>
<one-to-many class="TCx1AdmdisT"/>
</bag>
</class>

<class name="TA3PatientT" table="a3.T_A3_Patient_T">
<composite-id unsaved-value="any">
<key-property name="participant" type="string column="Participant_ID"/>
<key-property name="patient" type="integer" column="PatID"/>
</composite-id>
<one-to-one name="ptSite" class="TCx1PtsiteT" constrained="true" outer-join="false"/>
<property name="race" column="Race" type="short" length="5"/>
</class>

Help me out...
Devesh


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 2:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use your debugger to find the cause of the exception. I am quite confident you wil be able to find the cause by yourself.

(You have anyway, given nowhere near enough information to solve this problem.)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 7:42 am 
Newbie

Joined: Mon Dec 01, 2003 7:00 am
Posts: 16
Hi Gavin,

This is the Exception get generated will retrive the object :-

SEVERE: IllegalArgumentException in class: com.ge.med.registries.acc_30.hibernat
e.TA3PatientT, getter method of property: participant
Dec 4, 2003 5:06:01 PM org.apache.commons.logging.impl.Jdk14Logger error
SEVERE: Exception initializing proxy
java.lang.IllegalArgumentException: object is not an instance of declaring class

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sf.hibernate.util.ReflectHelper$Getter.get(ReflectHelper.java:94)

at net.sf.hibernate.type.ComponentType.getPropertyValue(ComponentType.ja
va:188)
at net.sf.hibernate.type.ComponentType.getPropertyValues(ComponentType.j
ava:208)
at net.sf.hibernate.type.ComponentType.nullSafeGetValues(ComponentType.j
ava:173)
at net.sf.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:16
0)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:486)

at net.sf.hibernate.loader.Loader.doFind(Loader.java:136)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:573)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:
392)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
at net.sf.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:1710
)
at net.sf.hibernate.proxy.LazyInitializer.initialize(LazyInitializer.jav
a:48)
at net.sf.hibernate.proxy.LazyInitializer.initializeWrapExceptions(LazyI
nitializer.java:55)
at net.sf.hibernate.proxy.LazyInitializer.getImplementation(LazyInitiali
zer.java:153)
at net.sf.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitia
lizer.java:49)
at com.ge.med.registries.acc_30.hibernate.TA3PatientT$$EnhancedByCGLIB$$
1.toString(<generated>)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at Retrive.main(Retrive.java:61)
rethrown as net.sf.hibernate.PropertyAccessException: IllegalArgumentException o
ccurred calling: object is not an instance of declaring class getter of com.ge.m
ed.registries.acc_30.hibernate.TA3PatientT.participant


The code is like this
Query q = sess.createQuery(
"from TCx1PatientT as patient " +
"where patient.primary =:primary"
);
System.out.println(q.toString());
q.setInteger("primary",primary);
List list = q.list();
if(list.size()>0)
{
patient = (TCx1PatientT) list.get(0);
}
tx.commit();

System.out.println("*********************"+patient);
System.out.println("*********************"+(TCx1PtsiteT) patient.getSite().get(0));
site = (TCx1PtsiteT) patient.getSite().get(0);
System.out.println("*********************"+site.getPatient());
System.out.println("*********************"+site.getParticipant());

//Booms here
System.out.println("*********************"+site.getAccPatient());

TA3Patient contain get and set property of particpant , then what can be reason of generation Getter property Exception.
For more information let me know

Devesh


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 7:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
probably your get/set pair is of the wrong type (should be java.lang.String)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 7:59 am 
Newbie

Joined: Mon Dec 01, 2003 7:00 am
Posts: 16
Define in TA3Patient class

public String getParticipant() {
return this.participant;
}

public void setParticipant(String participant) {
this.participant = participant;
}

then ?????


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 8:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use your debugger to find the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 04, 2003 8:21 am 
Newbie

Joined: Mon Dec 01, 2003 7:00 am
Posts: 16
If u see the mapping file

Table T_CX1_PtSite_T has one-to-one relationship with a3.T_A3_Patient_T

on two keys i.e. Participant_ID and PatID

and in case of one-to-one we cann't define column name on which there is one-to-one relationship as it is take care by Hibernate only.

I think that may be root cause of the problem

If so , what way I can define the relationship .


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