-->
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.  [ 1 post ] 
Author Message
 Post subject: Controll Reverse Engineering to allow many to many in myisam
PostPosted: Tue May 17, 2011 3:36 am 
Newbie

Joined: Thu Aug 16, 2007 11:42 am
Posts: 2
I don't know does somebody can solve this problem but I will try...

I know how to create relationship "many-to-one" but how to create "many-to-many" relationship when you are facing myisam tables in mysql.

Here is the table structure:

CREATE TABLE `worker_zrm` (
`id_worker` int(10) unsigned NOT NULL,
`id_zrm` int(10) unsigned NOT NULL,
UNIQUE KEY `UNIQUE` (`id_worker`,`id_zrm`),
KEY `WORKER` (`id_worker`),
KEY `ZRM` (`id_zrm`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `worker` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`kontact` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `zrm` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`type` int(10) unsigned NOT NULL default '2',
`id_station` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `id_station` (`id_station`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `order` (
`id` int(10) unsigned NOT NULL auto_increment,
`pw_nr` int(10) unsigned default NULL,
`zrm_id` int(10) unsigned default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

There is no foreign keys because myisam doesn't support it but I want in my generated class for `order` table to fetch all workers in zrm. Zrm is a group of workers. Table `worker_zrm` tell us which worker belong to which zrm. In table `order` we have column `zrm_id` so we want in our generated class for `order` to have such method getWorkers() with return type List<Worker>. Is there any posibility to do that with reverse enginnering tool?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.