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: Complex DTO not loaded when implementing IcompositeUserType
PostPosted: Tue Sep 02, 2008 5:49 am 
Newbie

Joined: Thu Apr 03, 2008 4:16 am
Posts: 18
I have two DTO which are implemented using user defined types using ICompositeuser type
1. PatientDTO
2. FallDTO

Structure of these objects is like my patientDTO has collection of FallDTO in one-to-many relationship

My PatientDTO looks like following


private mycomplexdatatype _Patientenid = new mycomplexdatatype();
public virtual mycomplexdatatype Patientenid
{
get
{
return _Patientenid;
}
set
{
_Patientenid = value;
}
}

where mycomplexdatatype is derived from ICompositeUserType which Nhibernate exposes to implement user defined data type.
My PatientDTO has a object collection of type FallDTO which is defined using Iset .

private ISet<FallDTO> _TBLFALLANWESEND = new HashedSet<FallDTO>();
public virtual ISet<FallDTO> TBLFALLANWESEND
{
get
{
return _TBLFALLANWESEND;
}
set
{
_TBLFALLANWESEND = value;
}
}

Now my problem is when I load my patientDTO its gets loaded with Null collection where I have set LazyLoad to false . My current problem is that there is no exception happening at this point its just that the collection is not loaded. My patient.hbm.xml files looks like this.


<class name="NHibernateConsole.PatientDTO, NHibernateConsole" table="TBLPATIENT" >
<id name="Patientenid" column="PATIENTENID" type="itb.Foundation.mycomplexdatatype , itb.Foundation" unsaved-value="null">

<generator class="assigned">
</generator>
</id>
<set name="TBLFALLANWESEND" cascade="none" inverse="false" lazy="false" >
<key>
<column name="PATIENTENID"/>
</key>
<one-to-many class="NHibernateConsole.FallDTO, NHibernateConsole"/>
</set>





Now if I change my ID column data type from user defined type that is using composite usertype to primitive data type the collection is loaded irrespective of whether my FallDTO has primitive or user defined type.Could anyone help me understand about what exactly is happening here. We have even tried the same with NHibernate version 2.0 but no success. Is it not possible to use user defined types and have complex DTOs All help is appreciated.













Hibernate version: 1.2

Mapping documents: as shown above

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

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject: Mmm
PostPosted: Wed Sep 03, 2008 1:08 am 
Newbie

Joined: Mon Nov 19, 2007 12:12 am
Posts: 5
I think this problem is different to the one i was having. I wasn't using a ICompositeUserType on a primary key.

Anyway I did manage a workaround using IPropertyAccessor instead but I'm not sure that will help you here.

Have you tried setting the cascade on your collection to something other than none. I suspect that your set is never being saved. Are you saving it explicitly or relying on saving it through a cascade via patientDTO?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2008 5:57 am 
Newbie

Joined: Thu Apr 03, 2008 4:16 am
Posts: 18
Hi Benjamin

Thx for replying .. about saving the objects using cascade is something we are not soing as yet . But regular save on single entity works fine. Its just the loading which is an issue. I can load the master object but not the child as part of collection. I am just trying to find if anybody here uses custom data types with Nhibernate. if yes then do the have one-to-many relationship working?


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.