-->
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: Component Mapping with component persisted to its own table
PostPosted: Mon Jul 18, 2005 3:47 am 
Newbie

Joined: Tue May 24, 2005 7:19 am
Posts: 7
Location: Ankara,Turkiye
Hibernate version:3

Name and version of the database you are using:Oracle 10G

Is it possible to map a composition relation, where component can be persisted in its own table, but not as attributes of parent table?

OR I mean a <Join> type mapping with its own class.

I can not find a such mapping.
Is it possible to do such mappings in Hibernate, or will it be possible in future?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 4:41 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
I think you need to use one-to-one or many-to-one association mapping.

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject: Component to its own table
PostPosted: Mon Jul 18, 2005 7:37 am 
Newbie

Joined: Tue May 24, 2005 7:19 am
Posts: 7
Location: Ankara,Turkiye
If I choose one-to-one then this means my component(value type) class is
now an entity. But It is not an entity. I only want to persist a component to its own table.


Top
 Profile  
 
 Post subject: Re: Component to its own table
PostPosted: Mon Jul 18, 2005 7:48 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
csenkal wrote:
If I choose one-to-one then this means my component(value type) class is
now an entity. But It is not an entity. I only want to persist a component to its own table.

I am not sure about Hibernate 3.x, but there is not multi-table class mapping in Hibernate 2.x

_________________
Leonid Shlyapnikov


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 7:54 am 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
http://www.hibernate.org/hib_docs/v3/re ... ation-join


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 11:36 am 
Newbie

Joined: Tue May 24, 2005 7:19 am
Posts: 7
Location: Ankara,Turkiye
As I have mentioned in my first post, if join type mapping then, this means that I divide One class into 2 or more tables.

What I wanted to do is to have 2 classes and 2 tables.
Not 1 class and 2 tables(JOIN)
OR
2 classes and 1 table(Component mapping)

1-1 mapping is the closest to what I want, but it assumes the component is an entity(for my case),
I can not understand why I just can not write something like

<component name="child" class="MyChild" table="MyChildTable">
<property name="xxx" type="string">
</property>
....
</component>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 18, 2005 11:44 am 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
csenkal wrote:
As I have mentioned in my first post, if join type mapping then, this means that I divide One class into 2 or more tables.

What I wanted to do is to have 2 classes and 2 tables.
Not 1 class and 2 tables(JOIN)
OR
2 classes and 1 table(Component mapping)

1-1 mapping is the closest to what I want, but it assumes the component is an entity(for my case),
I can not understand why I just can not write something like

<component name="child" class="MyChild" table="MyChildTable">
<property name="xxx" type="string">
</property>
....
</component>


Code:
<join [b]table="MyChildTable"[/b]>
       
        <key ... />

<component name="child" class="MyChild">
            <property name="xxx" type="string">
            </property>
        ...
</component>
</join>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 3:06 am 
Newbie

Joined: Tue May 24, 2005 7:19 am
Posts: 7
Location: Ankara,Turkiye
I think that will do it


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.