-- MySQL Administrator dump 1.4
--
-- ------------------------------------------------------
-- Server version	5.0.18-nt


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;


--
-- Create schema hibernate
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ hibernate;
USE hibernate;

--
-- Table structure for table `hibernate`.`assegnazione_compiti`
--
CREATE TABLE `assegnazione_compiti` (
  `fk_persona` int(10) unsigned NOT NULL default '0',
  `fk_job` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`fk_persona`,`fk_job`),
  KEY `FK_job` (`fk_job`),
  CONSTRAINT `FK_job` FOREIGN KEY (`fk_job`) REFERENCES `job` (`id_job`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_persona` FOREIGN KEY (`fk_persona`) REFERENCES `persona` (`id_persona`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `hibernate`.`assegnazione_compiti`
--

/*!40000 ALTER TABLE `assegnazione_compiti` DISABLE KEYS */;
INSERT INTO `assegnazione_compiti` (`fk_persona`,`fk_job`) VALUES 
 (1,1),
 (1,2),
 (2,4),
 (4,4),
 (2,5),
 (4,5),
 (3,6),
 (3,7);
/*!40000 ALTER TABLE `assegnazione_compiti` ENABLE KEYS */;


--
-- Table structure for table `hibernate`.`dipartimento`
--
CREATE TABLE `dipartimento` (
  `id_dipartimento` int(10) unsigned NOT NULL auto_increment,
  `nome` varchar(45) NOT NULL default '',
  `sede` varchar(45) NOT NULL default '',
  PRIMARY KEY  (`id_dipartimento`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `hibernate`.`dipartimento`
--

/*!40000 ALTER TABLE `dipartimento` DISABLE KEYS */;
INSERT INTO `dipartimento` (`id_dipartimento`,`nome`,`sede`) VALUES 
 (1,'programmazione 1','Roma'),
 (2,'programmazione 2','Roma'),
 (3,'personale','Milano');
/*!40000 ALTER TABLE `dipartimento` ENABLE KEYS */;


--
-- Table structure for table `hibernate`.`job`
--
CREATE TABLE `job` (
  `id_job` int(10) unsigned NOT NULL auto_increment,
  `nome` varchar(45) NOT NULL default '',
  PRIMARY KEY  (`id_job`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `hibernate`.`job`
--

/*!40000 ALTER TABLE `job` DISABLE KEYS */;
INSERT INTO `job` (`id_job`,`nome`) VALUES 
 (1,'scrivere codice'),
 (2,'scrivere documentazione'),
 (3,'assumere'),
 (4,'rispondere alle mail'),
 (5,'dialogare con i clienti'),
 (6,'definire i requisiti'),
 (7,'fare test');
/*!40000 ALTER TABLE `job` ENABLE KEYS */;


--
-- Table structure for table `hibernate`.`persona`
--
CREATE TABLE `persona` (
  `id_persona` int(10) unsigned NOT NULL auto_increment,
  `nome` varchar(45) NOT NULL default '',
  `fk_dipartimento` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id_persona`),
  KEY `fk_dipartimento` (`fk_dipartimento`),
  CONSTRAINT `fk_dipartimento` FOREIGN KEY (`fk_dipartimento`) REFERENCES `dipartimento` (`id_dipartimento`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `hibernate`.`persona`
--

/*!40000 ALTER TABLE `persona` DISABLE KEYS */;
INSERT INTO `persona` (`id_persona`,`nome`,`fk_dipartimento`) VALUES 
 (1,'leonardo',1),
 (2,'ale',1),
 (3,'claudio',2),
 (4,'nazzarena',3),
 (5,'leo',2),
 (6,'alex',3);
/*!40000 ALTER TABLE `persona` ENABLE KEYS */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
