-->
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.  [ 6 posts ] 
Author Message
 Post subject: mapping one table to one objectand collection of other objec
PostPosted: Fri Aug 20, 2004 9:44 am 
Newbie

Joined: Fri Aug 20, 2004 9:07 am
Posts: 8
Hibernate version:
2.1.6
here is the definition of my table:

[
id number
login varchar2
passwd varchar2

[color=blue]A
1 number
B1 number
C1 number

A2 number
B2 number
C2 number

][/color]
i want to mapp this table to a class CLASS1 which have id, login, passwd and a collection of an other class CLASS2, this class must have A, B and C property
how i can do it ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 20, 2004 6:53 pm 
Beginner
Beginner

Joined: Mon Aug 09, 2004 12:31 pm
Posts: 47
Location: New York, NY, USA
I'm not sure what you mean, but it sounds like, you want to have a collection with two instances of Class2, one that corresponds to A1, B1 and C1 and the other that maps to A2, B2, C2?

You probably should use two components instead.

_________________
--DP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 5:13 am 
Newbie

Joined: Fri Aug 20, 2004 9:07 am
Posts: 8
yes!
i have a collection on the table
really i have A1, B1, C1 .... A6,B6,C6 in the table whitch i want to mapp to class1 so the A,B and C property muast mapped to an other class , class2
so can i mapp group of columns to a collection??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 5:24 am 
Newbie

Joined: Fri Aug 20, 2004 9:07 am
Posts: 8
en francai peut etre c plus claire:

g une table table1 dont la definition est:

id number
login varchar2
passwd varchar2

A1 number
B1 number
C1 number

A2 number
B2 number
C2 number

cette table doit etre mappe vers la classe CLASS1.
dans table1, g une serie de colonne A, B et C ( c un modele de donne qui n'est pas tres propre mais je suis oblige d'utilise ce model la)
g besoin de travaille avec un modele en classe qui est plus propre, c a dire, a une classe CLASS1 il correspond une collection de CLASS2 .
CLASS2 doit avoir les champs A, B et C


le probleme est de mapper une serie de colonne vers une collection

merci pour votre aide


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 5:39 am 
Regular
Regular

Joined: Wed Aug 18, 2004 5:16 am
Posts: 69
Location: Modena, Italy
This is not a one-to-many relation, this is a Class with many components (the number of these components depends on many columns you have) every one with three properties (A, B and C).

If you need a collection then you have to put ABC values in another table or create the collection at runtime with a method in your class that collect all components in a Collection


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 6:29 am 
Newbie

Joined: Fri Aug 20, 2004 9:07 am
Posts: 8
sure i can put ABC to an other table
so i surch other solution with hibernate mapping
think you for your collaboration


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