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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate mapping files
PostPosted: Fri Apr 18, 2008 7:39 am 
Newbie

Joined: Fri Apr 18, 2008 6:54 am
Posts: 2
Location: London
I don't know if I'm going to be able to explain it property but I'm going to try it.

Basically I've got projects, that they have inside galleries. Each gallery has media associated sorted.

I've got 4 tables, witch ones I can't change the structure, because there is a big system behind them.

This is the database structure:


CREATE TABLE `_projects` (
`ID` int(11) NOT NULL auto_increment,
`active` int(11) default '1',
`projectName` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

---------------------------------------------------------
CREATE TABLE `_galleriesType` (
`ID` int(11) default NULL,
`description` varchar(252) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

---------------------------------------------------------
CREATE TABLE `_siteMedia` (
`ID` int(11) NOT NULL auto_increment,
`source` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

------------------------------------------------------------

CREATE TABLE `_projectsPagesMediaLookup` (
`ID` int(11) NOT NULL auto_increment,
`FK_siteMediaID` int(11) default NULL,
`FK_projectsPagesID` int(11) default NULL,
`FK_galleryID` int(11) default NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


I would like to get my object formatted on this way:

Project
-id
-description
-galleries
-----------gallery 1
----------------------------media1
----------------------------media2
----------------------------media3

-----------gallery 2
----------------------------media4
----------------------------media5
----------------------------media6

And I wouldn't like to add a new gallery row each time I add a new project, because the only reason why galleries it's there is because I want to get the media separate in groups, but it shouldn't be a big problem to add galleries for each project.

The problem I've got is that I don't know how to create the list with galleries in the Project.hbm.xml, basically I don't know if it's a composite component or a many to any or any other relation.

Any idea of how can I create the project.hbm.xmll??

Thanks.


Top
 Profile  
 
 Post subject: Sorry
PostPosted: Fri Apr 18, 2008 7:41 am 
Newbie

Joined: Fri Apr 18, 2008 6:54 am
Posts: 2
Location: London
Sorry there were a mistake in the structure, here it's the right one.


CREATE TABLE `_galleries` (
`ID` int(11) default NULL,
`description` varchar(252) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


CREATE TABLE `_projects` (
`ID` int(11) NOT NULL auto_increment,
`active` int(11) default '1',
`projectName` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


CREATE TABLE `_siteMedia` (
`ID` int(11) NOT NULL auto_increment,
`source` text,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


# Dump of table _projectsPagesMediaLookup
# ------------------------------------------------------------

CREATE TABLE `_projectsMediaLookup` (
`ID` int(11) NOT NULL auto_increment,
`FK_siteMediaID` int(11) default NULL,
`FK_projectID` int(11) default NULL,
`FK_galleryID` int(11) default NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


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