This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Replacement of comma-delimited lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Replacement of comma-delimited lists" Watch "Replacement of comma-delimited lists" New topic

Replacement of comma-delimited lists

Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
I'm currently designing a "project manager" webapp and I have a few questions regarding design (I'm using Hibernate and PostgreSQL.) I have two tables; one for projects and one for developers. In the project table, I have a column that specifies assigned developers. In the developer table, I have a column that specifies assigned projects. Both of these feilds contain comma-delimited lists and are formatted as text. Is there an alternative to this? Ideally, I want my accessor methods to be using either Lists or Collections.

Any help would be endlessly appreciated, Thank you for your time!

Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
Ooops I guess this is the wrong place to put this post. Can a moderater please lock and move this for me?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63333

No, I'd say that this is in the right place.

That's a whacky table structure. Rather than munging the multipe values together into a comma-separated list, the more usual approach would be to store the values individually in a related table, associating the list members with the "owning" record's primary key.

In this case it appear you want to create a separate table that assoicates developers with projects, and vice versa.
[ March 20, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Daniel Prene
Ranch Hand

Joined: Jul 15, 2005
Posts: 241
Thank you for the advice. If I did it that way would I be able to grab the data in lists? In what way will the Hibernate stuff be set up? Do you know of any helpfull articles specifically? What should I google?

Thank you Bear, you're the best.
I agree. Here's the link:
subject: Replacement of comma-delimited lists
It's not a secret anymore!