-->
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: is this use of objects over-kill?
PostPosted: Sun Oct 05, 2003 9:00 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
in a web enviroment I have a User object that needs to keep track of things like 'Favorite Music Types' and 'Genders I'd like to Meet' these options are all selected via checkboxes so they can select all, none or some.

right now ive got a many-to-many association between my User and MusicType objects and many-to-many between User and GendersToMeet objects (collection of Gender objects) , both MusicType and GendersToMeet have simple id/name propertys, so my question is, is this overkill?

my User objects need to keep track of lots of different info like this so im ending up with lots of these many-to-many collections, just wondering if theres a simpler alternative?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 06, 2003 2:37 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
someone help me out here :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 06, 2003 4:58 pm 
Beginner
Beginner

Joined: Fri Aug 29, 2003 12:38 am
Posts: 22
Location: Phoenix, AZ
Perhaps a persistent enum would suit better?

http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s2-3


Top
 Profile  
 
 Post subject: Re: is this use of objects over-kill?
PostPosted: Tue Oct 07, 2003 8:59 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
lagcisco wrote:
in a web enviroment I have a User object that needs to keep track of things like 'Favorite Music Types' and 'Genders I'd like to Meet' these options are all selected via checkboxes so they can select all, none or some.

right now ive got a many-to-many association between my User and MusicType objects and many-to-many between User and GendersToMeet objects (collection of Gender objects) , both MusicType and GendersToMeet have simple id/name propertys, so my question is, is this overkill?

my User objects need to keep track of lots of different info like this so im ending up with lots of these many-to-many collections, just wondering if theres a simpler alternative?


I think RDBMS is a overkill for this use case, you can store this kind of data in Cookies.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 9:06 am 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
hmm no i dont think cookies is a good place to store this data, i need to be able to run report against the DB too, like whats favorite music type is FOOBAR


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 9:09 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I hope the "storing in cookies" was a joke. :)

You can model this with component, collections of components or even enumeration classes. There are many ways to avoid full entity realtionships, but this is more in the scope of object-oriented domain models, not Hibernate.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.