-->
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: Mapping problem with polumorphic tables and HQL
PostPosted: Fri Oct 29, 2004 2:58 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
Hibernate version:
2.1.6 or 3.0alpha

Name and version of the database you are using:
Oracle 9i2


I am trying to add in support for our data tables in hibernate, but am running into some problems.

Here is the basic setup:
We have multiple servers with differents sets of data tables, let's call these form_a_data, form_b_data,etc. One server might have 3, another 6, etc. Each of these has different fields represented by a separate column ( i.e. not denormalized)

We have a single table that has an entry for every record in the system, which could be used to lookup which is the correct table, let's call this table patientRecords.

What i would like is to have the following setup.

1.) A FormData class which can hold data for any one of these tables.
2.) A PatientRecord class which can refer to any FormData class.
3.) A way of using hsl to query that data. I would like to be able to to write 'where record.forms['baseline'].arrivalDate < record.forms['baseline'].departureDate' or something similar.

I know this is a lot to ask...
Now, I'll tell you what i have tried:
Table-per-class polymorphism:
one-to-one mapping in record to a FormData table with a set of concrete subclasses.This works well,since I can query, although not that elegantly. The problem is that a.) queries run across multiple tables ( not the end of the world), but more importantly, if one of those tables is not there, then it crashes.

CompositeUserType: I implemented something that would return a class called Formdata that has a primary key and a Map of data. This would be ok, except that i don't know how I could query this, since hibernate has no idea what the Map persists to.

I also looked at the Dynamic-class, which almost helps, except that I would like to be able to lookup the metadata at run time.

Is there anyway of doing this? I have spend countless hours working on this, and while I really like hibernate, this is driving me nuts. I am more than happy to contribute code, or whatever in order to get this work, but i need some help.

I have read through all of the discussions of CompositeUsertype, UserType ( which i can't use since i neeed to be able to perform queries), and haven't found what i need.


Top
 Profile  
 
 Post subject: Additional stuff
PostPosted: Fri Oct 29, 2004 6:54 pm 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
so... the more I look into this, the more I think that the only way that I can do this is through by implementing the Queryable interface as well as the Persister interface.
This is a real pain, so please tell me if I am missing something.


Top
 Profile  
 
 Post subject: Solution
PostPosted: Mon Nov 01, 2004 11:14 am 
Newbie

Joined: Thu Aug 19, 2004 10:52 am
Posts: 14
Well - i am still not sure if this is the best solution, but I wound up implementing a custom persister and the queryable interface. It seems to work so far, although I have a long way to go before it is fully functional.

I will post the code once I get it 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.