-->
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.  [ 8 posts ] 
Author Message
 Post subject: CompositeUserType that has another CompositeUserType
PostPosted: Mon Apr 30, 2007 8:34 am 
Newbie

Joined: Mon Nov 13, 2006 11:40 am
Posts: 6
Hi ,
how to create CompositeUserType, that has CompositeUserType attribute?

Example:

public class AUserType implements CompositeUserType {
public Class returnedClass() {
return A.class;
}
}

public class BUserType implements CompositeUserType {
public Class returnedClass() {
return B.class;
}
}

class A{
B b;
}

class B{

}

class EnclosingClass{
A a;
}


How can I "flatten" all data of all those classes(EnclosingClass,A,B) in table EnclosingClassTable?

There are no examples.

Please, help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:28 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
wut? http://www.hibernate.org/ForumMailingli ... AskForHelp

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:35 am 
Newbie

Joined: Mon Nov 13, 2006 11:40 am
Posts: 6
That means:
how can I enforce hibernate to put all data of classes EnclosingClass, A, B into single table?

In simplest words:

is it really possible to create tree of CompositeUserObjects(that one is parent for other...), and then save entire tree in single table?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:39 am 
Newbie

Joined: Mon Nov 13, 2006 11:40 am
Posts: 6
adamgibbons wrote:


I did not find similar situation in tutorials and in docs.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:43 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
beep_beep wrote:
is it really possible to create tree of CompositeUserObjects(that one is parent for other...), and then save entire tree in single table?

I somehow doubt it. Ask Max.
Hibernate isn't the magic bullet solution people seem to think it is. Sure you can do plenty with it, and it's fairly flexible, but it won't do every crazy thing you can posibly think of.
Why would you want to save an entire tree in one table? That's not very OO or Normalised. If you go against core princibels like that then you're not going to get on very well with Hibernate.

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 9:54 am 
Newbie

Joined: Mon Nov 13, 2006 11:40 am
Posts: 6
adamgibbons wrote:
beep_beep wrote:
is it really possible to create tree of CompositeUserObjects(that one is parent for other...), and then save entire tree in single table?

I somehow doubt it. Ask Max.
Hibernate isn't the magic bullet solution people seem to think it is. Sure you can do plenty with it, and it's fairly flexible, but it won't do every crazy thing you can posibly think of.
Why would you want to save an entire tree in one table? That's not very OO or Normalised. If you go against core princibels like that then you're not going to get on very well with Hibernate.



It is not against core principals.

I have requirement to "flatten" all data from 2 objects: A and B in single table, when A "has" B.
Note: there is no requirement to flatten A that "has" COLLECTION of Bs.
So no principals violation.

And I supposed to gain this possibility from Hibernate almost free of charge, because it is looks like CompositeUserType is built for that, but unfortunatelly it able to work only down to simple types in CompositeUserType , not to attribute, that is CompositeUserType itself.

It would be nice to have that feature, but It seems we have not this one.
Thanks for answering, but it seems to me you did not understand completelly my question.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 10:04 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
Why not simply store the data in 2 tables? One referencing the other...

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 2:43 pm 
Newbie

Joined: Mon Nov 13, 2006 11:40 am
Posts: 6
adamgibbons wrote:
Why not simply store the data in 2 tables? One referencing the other...


It's given by God(business decision).
But It seems to me even if I have this agreement to use separate tables, UserType would not help.Right?


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